package com.ss.android.wenda.answer.detail2;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebBackForwardList;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;

import com.bytedance.article.common.c.JSONObjectWrapper;
import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.b.UserAgentCompat;
import com.bytedance.common.b.WebViewPauseResumeCompat;
import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.NetworkType;
import com.bytedance.common.utility.UIUtils;
import com.bytedance.common.utility.collection.WeakHandler;
import com.ss.android.account.Spipe;
import com.ss.android.account.c.QZone;
import com.ss.android.action.a.a.Comment;
import com.ss.android.action.a.c.ShareDialog;
import com.ss.android.action.ArticleActionHelper;
import com.ss.android.action.b.ImpressionHelper;
import com.ss.android.article.base.ImageProvider;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.app.BizApplication;
import com.ss.android.article.base.feature.app.a.ArticleConstants;
import com.ss.android.article.base.feature.app.b.DBHelper;
import com.ss.android.article.base.feature.app.d.ImpressionListAdapter;
import com.ss.android.article.base.feature.app.e.TTAndroidObject;
import com.ss.android.article.base.feature.detail.model.ArticleDetail;
import com.ss.android.article.base.feature.detail.model.ArticleInfo;
import com.ss.android.article.base.feature.detail.model.CommentWrapper;
import com.ss.android.article.base.feature.detail.model.WendaNextPage;
import com.ss.android.article.base.feature.detail.presenter.ActivityStackManager;
import com.ss.android.article.base.feature.detail.presenter.ActivityStackManager.Type;
import com.ss.android.article.base.feature.detail.presenter.ArticleTabComment;
import com.ss.android.article.base.feature.detail.presenter.ArticleTabCommentsRequestTask;
import com.ss.android.article.base.feature.detail.presenter.CommentFetcher;
import com.ss.android.article.base.feature.detail.presenter.CommentTabCache;
import com.ss.android.article.base.feature.detail.presenter.DetailHelper;
import com.ss.android.article.base.feature.detail.presenter.DetailLoader;
import com.ss.android.article.base.feature.detail.view.DetailScrollView;
import com.ss.android.article.base.feature.detail.view.MyWebViewClient;
import com.ss.android.article.base.feature.detail.view.MyWebViewClientV11;
import com.ss.android.article.base.feature.detail.view.DetailWebChromeClient;
import com.ss.android.article.base.feature.detail2.article.a.NewDetailPageExtra;
import com.ss.android.article.base.feature.detail2.article.a.NewDetailViewHolder;
import com.ss.android.article.base.feature.detail2.b.NewDetailAdapter;
import com.ss.android.article.base.feature.detail2.c.NewArticleDetailTTAndroidObject;
import com.ss.android.article.base.feature.detail2.SSPage;
import com.ss.android.article.base.feature.detail2.event.ThumbPreviewStatusEvent;
import com.ss.android.article.base.feature.detail2.ArticleDetailWebPage;
import com.ss.android.article.base.feature.detail2.widget.m;
import com.ss.android.article.base.feature.e.ArticleShareHelper;
import com.ss.android.article.base.feature.model.AppAd;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.DownloadAppAd;
import com.ss.android.article.base.feature.pgc.PgcActivity;
import com.ss.android.article.base.feature.splash.SplashAdActivity;
import com.ss.android.article.base.feature.subscribe.b.SubscribeManager;
import com.ss.android.article.base.feature.update.a.UserInfo;
import com.ss.android.article.base.feature.update.b.UpdateItemMgr;
import com.ss.android.article.base.feature.video.IVideoFullscreen;
import com.ss.android.article.base.ui.NoDataViewFactory$ImgType;
import com.ss.android.article.base.ui.aa;
import com.ss.android.article.base.ui.DiggAnimationView;
import com.ss.android.article.base.utils.ArticleHelper;
import com.ss.android.article.common.ThumbPreviewActivity;
import com.ss.android.article.common.share.helper.CommonHtmlShareHelper;
import com.ss.android.article.common.share.entry.ArticleDetailShareBean;
import com.ss.android.b.a.BaseAdsData;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.common.callback.CallbackCenter;
import com.ss.android.common.callback.SSCallback;
import com.ss.android.common.app.IComponent;
import com.ss.android.common.app.LifeCycleMonitor;
import com.ss.android.common.app.WebViewTweaker;
import com.ss.android.common.app.AbsFragment;
import com.ss.android.common.applog.AppLog;
import com.ss.android.common.dialog.AlertDialog;
import com.ss.android.common.ui.view.FullscreenVideoFrame;
import com.ss.android.common.ui.view.SwipeOverlayFrameLayout;
import com.ss.android.common.util.AnimatorUtil;
import com.ss.android.common.util.LoadUrlUtils;
import com.ss.android.common.util.NetworkUtils;
import com.ss.android.common.util.ToolUtils;
import com.ss.android.common.util.UrlBuilder;
import com.ss.android.common.util.json.JsonUtil;
import com.ss.android.image.loader.LargeImageCtxRef;
import com.ss.android.image.model.ImageInfo;
import com.ss.android.messagebus.Subscriber;
import com.ss.android.messagebus.SubscriptionRouter;
import com.ss.android.model.AbsArticle;
import com.ss.android.model.BaseArticle;
import com.ss.android.model.ItemType;
import com.ss.android.newmedia.BaseAppData;
import com.ss.android.newmedia.a.AdsAppBaseActivity;
import com.ss.android.newmedia.a.w;
import com.ss.android.newmedia.a.AbstractFooter;
import com.ss.android.newmedia.e.JsObject;
import com.ss.android.newmedia.e.ShareHelper;
import com.ss.android.newmedia.e.WapStatHelper;
import com.ss.android.newmedia.f.Response;
import com.ss.android.newmedia.util.AppUtil;
import com.ss.android.newmedia.util.InfoLRUCache;
import com.ss.android.newmedia.webview.SSWebSettings;
import com.ss.android.wenda.ui.NextAnswerView;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class NewAnswerDetailFragment extends AbsFragment implements
        WeakHandler.Callback,
        ShareDialog.b$a,
        ImageProvider.OnRemoteImageLoadedListener,
        com.ss.android.article.base.feature.detail.presenter.a,
        DetailHelper.SimpleArticle,
        DetailLoader.Callback,
        SSPage,
        ArticleDetailWebPage,
        m,
        LargeImageCtxRef,
        w,
        JsObject.ContextDataProvider {
    final class q$a {
        public String url;
        public int screencount;
        public int maxscrollheight;
        public float precentage;
        public int e;

        q$a(byte arg1) {
            this();
        }

        private q$a() {

            this.e = 0;
        }

        public final String toString() {
            return "url = " + this.url
                    + ", screencount = " + this.screencount
                    + ", precentage = " + this.precentage
                    + ", maxscrollheight = " + this.maxscrollheight;
        }
    }

    final class q$b {
        int a;
        ImpressionListAdapter b;

        q$b() {

        }
    }

    static final class c extends AbstractFooter {
        private final NewAnswerDetailFragment j;

        public c(NewAnswerDetailFragment arg1, View arg2) {
            super(arg2);
            this.j = arg1;

        }

        public final void onUserClick() {
            if (NewAnswerDetailFragment.a(this.j) != null) {
                NewAnswerDetailFragment.a(this.j, this.j.c, NewAnswerDetailFragment.a(this.j));
                NewAnswerDetailFragment v0 = this.j;
                NewAnswerDetailFragment.a(this.j);
                NewAnswerDetailFragment.v(v0);
            }
        }

        public final void switchToLoading() {
            super.switchToLoading();
            NewAnswerDetailFragment v0 = this.j;
            if (v0.mNoNetView != null) {
                v0.mNoNetView.setVisibility(View.GONE);
            }
        }
    }

    private long A;
    private String B;
    private String C;
    private boolean D;
    private SwipeOverlayFrameLayout E;
    private Resources F;
    private DBHelper G;
    private ProgressBar H;
    private DiggAnimationView I;
    private ArticleActionHelper mArticleActionHelper;
    private NewDetailViewHolder mNewDetailViewHolder;
    private boolean L;
    private boolean M;
    private boolean N;
    private int O;
    private String P;
    private String Q;
    private String R;
    private long S;
    private long T;
    private boolean U;
    private boolean V;
    private boolean W;
    private boolean X;
    private boolean Y;
    private boolean Z;
    public static final String TAG = NewAnswerDetailFragment.class.getSimpleName();
    private LinearLayout aA;
    private NewArticleDetailTTAndroidObject.AbsOnGetSeriesLinkPositionListener aB;
    private QZone.a$a aC;
    private SSCallback aD;
    private LayoutInflater aE;
    private MyWebViewClient mMyWebViewClient;
    private DetailWebChromeClient aG;
    private String aH;
    private int aI;
    private InfoLRUCache aJ;
    private InfoLRUCache aK;
    private com.ss.android.wenda.answer.detail2.a aL;
    private boolean aM;
    private NewArticleDetailTTAndroidObject aN;
    private int aO;
    private boolean aP;
    private boolean aQ;
    private String aR;
    private boolean aS;
    private Runnable aT;
    private boolean aU;
    private int[] aV;
    private final Map aW;
    private final Map aX;
    private View.OnClickListener aY;
    private boolean aa;
    private boolean ab;
    private boolean ac;
    private FullscreenVideoFrame mFullscreenVideoFrame;
    private View ae;
    private WebChromeClient.CustomViewCallback mCustomViewCallback;
    private boolean ag;
    private String ah;
    private final WeakHandler mWeakHandler;
    private DetailHelper aj;
    private boolean ak;
    private boolean al;
    private String am;
    private Map an;
    private View.OnClickListener ao;
    private boolean ap;
    private boolean aq;
    private boolean ar;
    private boolean as;
    private boolean at;
    private boolean au;
    private long av;
    private NextAnswerView aw;
    private int ax;
    private boolean ay;
    private WendaNextPage az;
    String b;
    long c;
    ArticleDetail mArticleDetail;
    Article mArticle;
    AppData mAppData;
    ViewGroup g;
    ProgressBar h;
    protected Spipe mSpipe;
    protected Context mContext;
    com.ss.android.article.base.ui.NoNetView mNoNetView;
    ImpressionListAdapter l;
    private ArticleShareHelper mArticleShareHelper;
    private boolean n;
    private long o;
    private BaseArticle p;
    private long q;
    private boolean r;
    private long s;
    private boolean t;
    private long u;
    private int v;
    private long w;
    private int x;
    private String y;
    private JSONObject z;

    public NewAnswerDetailFragment() {
        this.n = true;
        this.o = 0;
        this.q = 0;
        this.x = 0;
        this.A = 0;
        this.D = false;
        this.L = true;
        this.M = false;
        this.N = false;
        this.O = 1;
        this.P = null;
        this.Q = null;
        this.R = null;
        this.S = 0;
        this.T = 0;
        this.U = false;
        this.V = false;
        this.W = false;
        this.X = false;
        this.Y = false;
        this.Z = false;
        this.aa = false;
        this.ab = false;
        this.ac = false;
        this.ag = true;
        this.ah = null;
        this.mWeakHandler = new WeakHandler(((WeakHandler.Callback) this));
        this.an = new HashMap();
        this.au = false;
        this.ax = 0;
        this.aB = new r(this);
        this.aC = new ac(this);
        this.aD = new ak(this);
        this.aH = null;
        this.aP = false;
        this.aQ = false;
        new ArrayList();
        this.aS = true;
        this.aT = new am(this);
        this.aU = false;
        this.aW = new HashMap();
        this.aX = new HashMap();
        this.aY = new ah(this);
    }

    static WendaNextPage A(NewAnswerDetailFragment arg1) {
        return arg1.az;
    }

    public final void onUserClickCloseBtn() {
        this.ab = true;
        this.a();
    }

    public final void onInfoBackClick() {
        this.x();
    }

    public final void onWriteCommentClick() {
        this.report("write_button");
        this.p();
    }

    public final void onCommentLayoutClick() {
        this.a(false, 4, false);
    }

    public final void onFavorBtnClick() {
        Article v1 = this.mArticle;
        if (v1 != null) {
            String v0 = v1.userRepin ? "unfavorite_button" : "favorite_button";
            this.a(v0, ((BaseArticle) v1));
            this.o();
        }

        if ((this.mAppData.j()) && v1 != null && (v1.userRepin)) {
            this.a(this.mContext, 2);
        }
    }

    public final void onShare() {
        if (this.mAppData.getAbSettings().isQQTopShare()) {
            this.a(true);
        } else {
            this.a(false);
        }
    }

    private void G() {
        if (this.mArticle != null && this.mNewDetailViewHolder != null) {
            switch (this.getCommentMode()) {
                case 1:
                case 2: {
                    if (!this.s()) {
                        ((NewAnswerDetailActivity) this.getActivity()).c(false);
                    }

                    this.mNewDetailViewHolder.mFooter.hideFooterContent();
                    this.mNewDetailViewHolder.mNewDetailPageExtra.setContentsVisibility(8);
                    this.mNewDetailViewHolder.mNewDetailAdapter.addAllComment((List) null);
                    this.mNewDetailViewHolder.mNewDetailAdapter.notifyDataSetChanged();
                    break;
                }
                default: {
                    if (!this.s()) {
                        ((NewAnswerDetailActivity) this.getActivity()).c(true);
                    }

                    this.mNewDetailViewHolder.mNewDetailPageExtra.setContentsVisibility(0);
                    if (this.mNewDetailViewHolder.mCommentTabCache == null) {
                        break;
                    }

                    this.a(this.mNewDetailViewHolder, this.mNewDetailViewHolder.mCommentTabCache);
                    break;
                }
            }

            Article v1 = this.mArticle;
            if (this.aU) {
                return;
            }

            this.aU = true;
            String v0 = "";
            switch (v1.getCommentMode()) {
                case 1: {
                    v0 = "no_comments_mode";
                    break;
                }
                case 2: {
                    v0 = "hide_mode";
                    break;
                }
            }

            if (android.support.design.a.isTextEmpty(v0)) {
                return;
            }

            this.a(v0, ((BaseArticle) v1));
        }
    }

    private int H() {
        int v0 = this.mNewDetailViewHolder == null || this.mNewDetailViewHolder.mWebView == null ? 0 : ((int) (UserAgentCompat.getScale(this.mNewDetailViewHolder.mWebView) * (((float) this.mNewDetailViewHolder.mWebView.getContentHeight()))));
        return v0;
    }

    private void I() {
        int v2 = View.INVISIBLE;
        int v1 = View.VISIBLE;
        NewDetailViewHolder v3 = this.mNewDetailViewHolder;
        if (v3 != null && v3.mNightModeOverlay != null) {
            if (!v3.isNightMode) {
                v3.mNightModeOverlay.setVisibility(v2);
            } else {
                int v0 = this.mArticle == null ? 1 : 0;
                View v3_1 = v3.mNightModeOverlay;
                if (v0 == 0) {
                    v1 = v2;
                }

                v3_1.setVisibility(v1);
            }
        }
    }

    private JSONObject J() {
        JSONObject v0 = null;
        try {
            if (android.support.design.a.isTextEmpty(this.P)) {
            } else {
                v0 = new JSONObject(this.P);
            }
            label_8:
            if (v0 == null) {
                v0 = new JSONObject();
            }
            if (this.w > 0) {
                v0.put("from_gid", this.w);
            }

            if (this.y != null) {
                v0.put("category_name", this.y);
            }

            if (this.mArticle == null) {
                return v0;
            }

            v0.put("user_id", this.mArticle.getUserId());
        } catch (JSONException v1) {
        }
        return v0;
    }

    private void K() {
        if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mFooter != null && this.mNewDetailViewHolder.mFooter.mFooterContent != null && !NetworkUtils.isNetworkAvailable(this.getContext())) {
            if (this.mNoNetView == null) {
                this.mNoNetView = android.support.design.a.a(this.getContext(),
                        this.mNewDetailViewHolder.mFooter.mFooterContent,
                        com.ss.android.article.base.ui.ac.a(NoDataViewFactory$ImgType.NOT_NETWORK),
                        com.ss.android.article.base.ui.ad.a(this.getString(com.ss.android.article.browser.R.string.not_network_tip)),
                        com.ss.android.article.base.ui.ab.a(new aa(this.getString(com.ss.android.article.browser.R.string.label_retry), new ae(this))));
            }

            this.mNoNetView.initNoDataActionBtn();
            this.mNoNetView.setVisibility(View.VISIBLE);
            this.mNewDetailViewHolder.mFooter.hide();
        }
    }

    private q$a L() {
        q$a v0;
        String v1 = this.M();
        if (v1 == null) {
            v0 = null;
        } else {
            v0 = (q$a) this.aX.get(v1);
            if (v0 == null) {
                v0 = new q$a((byte) 0);
                v0.url = v1;
                v0.e = this.aX.size();
                this.aX.put(v1, v0);
            }
        }

        return v0;
    }

    private String M() {
        String v0 = null;
        if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mWebView != null) {
            String v1 = this.mNewDetailViewHolder.mWebView.getOriginalUrl();
            if (!android.support.design.a.isTextEmpty(v1) && !v1.equals("about:blank")) {
                v0 = f(v1);
            }
        }

        return v0;
    }

    private int N() {
        int v0 = 0;
        int v1 = this.m();
        int v2 = this.H();
        if (v1 != 0 && v2 != 0) {
            int v3 = v2 / v1;
            if (v2 % v1 != 0) {
                v0 = 1;
            }

            v0 += v3;
        }

        return v0;
    }

    private void O() {
        int v0 = 0;
        this.c("");
        if (this.l != null) {
            this.l.onPause();
        }

        int v1 = this.m();
        int v2 = this.H();
        q$a v3 = this.L();
        if (v3 != null) {
            int v4 = v3.maxscrollheight;
            if (v1 != 0 && v2 != 0) {
                float v4_1 = (((float) (v4 + v1))) / (((float) v2));
                int v5 = v2 / v1;
                if (v2 % v1 != 0) {
                    v0 = 1;
                }

                v3.screencount = v0 + v5;
                v3.precentage = Math.max(v3.precentage, v4_1);
                return;
            }

            v3.screencount = 0;
            v3.precentage = 0f;
        }
    }

    static void a(NewAnswerDetailFragment arg1, boolean arg2) {
        if (!arg1.s() && (arg1.ap) && (arg1.aS)) {
            if ((arg2) && !arg1.aq) {
                arg1.aq = true;
                ((NewAnswerDetailActivity) arg1.getActivity()).k.d();
                return;
            }

            if (arg2) {
                return;
            }

            if (!arg1.aq) {
                return;
            }

            arg1.aq = false;
            ((NewAnswerDetailActivity) arg1.getActivity()).k.e();
        }
    }

    static NewDetailViewHolder a(NewAnswerDetailFragment arg1) {
        return arg1.mNewDetailViewHolder;
    }

    final void a(NewDetailViewHolder arg3) {
        if (arg3 != null && arg3.mNewDetailPageExtra != null) {
            this.f(arg3);
            this.checkAndReportLikeAndRewardsShow(arg3);
            this.e(arg3);
            this.d(arg3);
            this.h(arg3);
            if (arg3.mNewDetailPageExtra != null) {
                arg3.mNewDetailPageExtra.a(this.aV);
            }

            if (arg3.mNewDetailAdapter.h) {
                arg3.mNewDetailAdapter.h = false;
            }

            c(arg3);
        }
    }

    static void a(NewAnswerDetailFragment arg0, String arg1) {
        arg0.d(arg1);
    }

    public final void a(Comment comment) {
        if (!this.s()) {
            NewDetailViewHolder v3 = this.mNewDetailViewHolder;
            if (v3 != null) {
                Article v4 = this.mArticle;
                if (v4 != null && comment != null) {
                    boolean v0 = v4.groupId != comment.groupId || v4.itemId != comment.itemId ? false : true;
                    if (!v0) {
                        v0 = v4.getItemKey().equals(comment.itemKey);
                    }

                    if (!v0) {
                        return;
                    }

                    if (android.support.design.a.isTextEmpty(comment.text)) {
                        return;
                    }

                    CommentTabCache v0_1 = this.a(this.c, this.mNewDetailViewHolder);
                    ArticleTabComment v5 = v0_1.mArticleTabComments[0];
                    v5.commentWrapperList.add(0, CommentWrapper.fromComment(comment));
                    if (v5.totalNumber >= 0) {
                        ++v5.totalNumber;
                    }

                    ArticleTabComment v6 = v0_1.mArticleTabComments[1];
                    v6.commentWrapperList.add(0, CommentWrapper.fromComment(comment));
                    if (v6.totalNumber >= 0) {
                        ++v6.totalNumber;
                    }

                    ++v4.commentCount;
                    if (v3.mCommentTabCache == v0_1) {
                        v3.mNewDetailPageExtra.setSofaLayoutVisibility(false);
                        v3.mNewDetailAdapter.addAllComment(v5.commentWrapperList);
                        v3.mNewDetailAdapter.notifyDataSetChanged();
                        this.c(v4);
                    }

                    this.a(true, 2, true);
                    if (this.aO <= 0) {
                        return;
                    }

                    if (this.aN == null) {
                        return;
                    }

                    this.aN.a(this.aO, comment.commentId);
                }
            }
        }
    }

    final void a() {
        String v0_1;
        String v1_1;
        int v0 = 1;
        if (Build.VERSION.SDK_INT != 19 || (this.au)) {
            v0 = 0;
        } else {
            int v1 = this.mArticle == null || !this.mArticle.hasArticleUrl() ? 0 : 1;
            if (v1 == 0) {
                v0 = 0;
            } else if (this.s > 0) {
                v0 = 0;
            } else if (this.mAppData.getAppSettings().disabledDelayFinish()) {
                v0 = 0;
            }
        }

        if (v0 != 0) {
            this.av = System.currentTimeMillis();
            LoadUrlUtils.loadUrl(this.mNewDetailViewHolder.mWebView, "about:blank");
            this.mWeakHandler.removeCallbacks(this.aT);
            this.mWeakHandler.postDelayed(this.aT, 100);
        } else {
            this.v();
            if (this.ac) {
                v1_1 = "back_gesture";
                v0_1 = "back_gesture";
            } else if (this.ab) {
                v1_1 = "close_button";
                v0_1 = "close_button";
            } else if (this.aa) {
                v1_1 = "page_close_button";
                v0_1 = "page_back_button";
            } else {
                v1_1 = "page_close_key";
                v0_1 = "back_key";
            }

            this.an.put("type", v0_1);
            this.aa = false;
            if (this.s()) {
                return;
            }

            ((NewAnswerDetailActivity) this.getActivity()).a(v1_1);
        }
    }

    protected final void a(String arg10, BaseArticle arg11) {
        long v6 = 0;
        if (arg11 != null && arg11.groupId > v6) {
            JSONObject v8 = new JSONObject();
            try {
                v8.put("item_id", arg11.itemId);
                v8.put("aggr_type", arg11.aggrType);
            } catch (JSONException v0) {
            }

            MobClickCombiner.onEvent(this.getContext(), "detail", arg10, arg11.groupId, v6, v8);
        }
    }

    static void a(NewAnswerDetailFragment arg5, long arg6, String arg8) {
        CommonHtmlShareHelper v0 = new CommonHtmlShareHelper(arg5.getContext());
        ArticleDetailShareBean v1 = new ArticleDetailShareBean();
        v1.content = arg8;
        v1.itemId = arg6;
        v1.isViewValid = arg5.isViewValid();
        v0.a(arg5.mArticle, new Object[]{v1});
    }

    private void a(NewDetailViewHolder arg4, CommentTabCache arg5) {
        if (arg4 != null && arg5 != null) {
            if (arg5.mArticleTabComments[0].isEmpty()) {
                arg4.mFooter.hideFooterContent();
                boolean v0 = arg5.mArticleTabComments[0].banComment;
                if (!v0 && this.mArticle != null) {
                    v0 = this.mArticle.mBanComment;
                }

                NewDetailPageExtra v2 = arg4.mNewDetailPageExtra;
                v0 = !v0 ? true : false;
                v2.setSofaLayoutVisibility(v0);
            } else {
                arg4.mFooter.setViewMoreText(com.ss.android.article.browser.R.string.ss_load_more);
                if (arg5.mArticleTabComments[0].hasMore) {
                    arg4.mFooter.switchToMoreContent();
                } else {
                    arg4.mFooter.hideFooterContent();
                }

                arg4.mNewDetailPageExtra.setSofaLayoutVisibility(false);
            }

            if (arg5.load[0]) {
                arg4.mFooter.switchToLoading();
            }

            arg4.mNewDetailAdapter.addAllComment(arg5.mArticleTabComments[0].commentWrapperList);
            arg4.mNewDetailAdapter.notifyDataSetChanged();
        }
    }

    static int a(NewAnswerDetailFragment arg0, int arg1) {
        arg0.ax = arg1;
        return arg1;
    }

    private View a(int arg2) {
        return this.g.findViewById(arg2);
    }

    private CommentTabCache a(long arg6, NewDetailViewHolder arg8) {
        Object v0 = this.aK.get(Long.valueOf(arg6));
        if (v0 == null) {
            CommentTabCache v0_1 = arg8.mCommentTabCache;
            if (v0_1 == null || arg6 != v0_1.itemId) {
                v0_1 = new CommentTabCache(arg6);
            }

            this.aK.put(Long.valueOf(arg6), v0_1);
        }

        if (arg8.mCommentTabCache != v0) {
            arg8.mCommentTabCache = ((CommentTabCache) v0);
        }

        return ((CommentTabCache) v0);
    }

    static CommentTabCache a(NewAnswerDetailFragment arg1, long arg2, NewDetailViewHolder arg4) {
        return arg1.a(arg2, arg4);
    }

    private void a(int arg2, int arg3) {
        if (!this.s()) {
            android.support.design.a.showImageToast(this.getContext(), arg3, arg2);
        }
    }

    private void a(long arg10) {
        if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mCommentTabCache != null && (this.mAppData.commentLoadMultiTab())) {
            ArticleTabComment v0 = this.mNewDetailViewHolder.mCommentTabCache.mArticleTabComments[1];
            if (!v0.hasComment) {
                CommentFetcher v1 = new CommentFetcher(v0.increateCounter(), this.mArticle, 1, 0, arg10);
                this.aL.a(v1.getItemKey(), v1);
                this.mNewDetailViewHolder.mCommentTabCache.load[1] = true;
            }
        }
    }

    private void a(Context arg7, int arg8) {
        int v2 = 2;
        if (arg8 != 1) {
            if (arg8 != v2) {
                return;
            }

            if (this.mSpipe.isLogin) {
                return;
            }

            if (!this.mAppData.j()) {
                return;
            }

            AlertDialog.Builder v1_1 = com.ss.android.j.b.createDialogBuilder(this.getActivity());
            v1_1.setMessage(com.ss.android.article.browser.R.string.ry);
            v1_1.setPositiveButton(com.ss.android.article.browser.R.string.rx, new com.ss.android.wenda.answer.detail2.aa(this));
            v1_1.setNegativeButton(com.ss.android.article.browser.R.string.label_cancel, new com.ss.android.wenda.answer.detail2.ab(this));
            MobClickCombiner.onEvent(this.getActivity(), "auth", "login_detail_favor");
            v1_1.setCancelable(true);
            if (this.isViewValid()) {
                v1_1.show();
            }

            this.mAppData.unloginFaverFirst = false;
        } else if (!this.mSpipe.isLogin && (this.mAppData.l())) {
            z v1 = new z(this);
            com.ss.android.article.base.feature.app.bb v0 = null;
            if (arg8 == 1) {
                v0 = new com.ss.android.article.base.feature.app.bb(arg7, "login_detail_comment");
                v0.a(0, com.ss.android.article.browser.R.string.rv, com.ss.android.article.browser.R.string.rt);
                v0.a(com.ss.android.article.browser.R.string.rs, ((View.OnClickListener) v1));
            } else if (arg8 == v2) {
                v0 = new com.ss.android.article.base.feature.app.bb(arg7, "login_detail_favor");
                v0.a(com.ss.android.article.browser.R.drawable.nq, com.ss.android.article.browser.R.string.rw, com.ss.android.article.browser.R.string.ru);
                v0.a(com.ss.android.article.browser.R.string.rr, v1);
            }

            if (v0 != null && arg7 != null && (this.isViewValid())) {
                v0.show();
                this.mAppData.unloginFaverFirst = false;
            }

            this.mAppData.a(System.currentTimeMillis());
            this.mAppData.m();
        }
    }

    private void a(WebView arg3) {
        if (arg3 != null) {
            String v0 = this.aH;
            if (!android.support.design.a.isTextEmpty(v0)) {
                arg3.getSettings().setUserAgentString(v0);
            }
        }
    }

    private void a(NewDetailViewHolder arg9, ArticleInfo arg10, boolean arg11) {
        Exception v1;
        boolean v2_1;
        boolean v0 = true;
        if (arg10 == null) {
            return;
        }

        if (arg9 == null) {
            return;
        }

        String v2 = arg10.context;
        if (!arg11 || (android.support.design.a.isTextEmpty(v2))) {
            v2_1 = false;
        } else {
            LoadUrlUtils.loadUrl(arg9.mWebView, "javascript:insertDiv(" + v2 + ")");
            v2_1 = true;
        }

        try {
            if (android.support.design.a.isTextEmpty(arg10.script)) {
                v0 = false;
            } else {
                LoadUrlUtils.loadUrl(arg9.mWebView, "javascript:" + arg10.script);
            }
        } catch (Exception v0_1) {
            Exception v7 = v0_1;
            v0 = false;
            v1 = v7;
            Logger.w(TAG, "load info script exception: " + v1);
        }

        if (Logger.debug()) {
            Logger.v(TAG, "embedContextInfo " + this.c + " " + v2_1 + " " + v0);
        }
    }

    private void a(NewDetailViewHolder arg26, Article arg27, long arg28) {
        CommentFetcher v7_3;
        int v6_3;
        long v6_2;
        if (arg26 != null) {
            if (!arg27.delete) {
                long v14 = arg27.groupId;
                long v16 = arg27.itemId;
                int v18 = arg27.aggrType;
                ArticleDetail v19 = this.mArticleDetail;
                if (v19 != null && !this.s()) {
                    if (v19.delete) {
                        ((NewAnswerDetailActivity) this.getActivity()).b(this.mArticle);
                    } else {
                        String v7 = v19.content;
                        String v8 = v19.h5Extra;
                        if (this.mArticleDetail.spipeUser != null && !android.support.design.a.isTextEmpty(this.mArticleDetail.spipeUser.mScreenName) && !android.support.design.a.isTextEmpty(this.mArticleDetail.spipeUser.mAvatarUrl)) {
                            this.ap = true;
                            FragmentActivity v6 = this.getActivity();
                            String v9 = this.mArticleDetail.spipeUser.mScreenName;
                            String v10 = this.mArticleDetail.spipeUser.mAvatarUrl;
                            View.OnClickListener v11 = this.aY;
                            Uri v10_1 = Uri.parse(v10);
                            ((NewAnswerDetailActivity) v6).k.setPgcLayoutVisibility(4);
                            ((NewAnswerDetailActivity) v6).k.setPgcName(((CharSequence) v9));
                            ((NewAnswerDetailActivity) v6).k.setPgcAvatar(v10_1);
                            ((NewAnswerDetailActivity) v6).k.setPgcClickListener(v11);
                        }

                        if (this.s > 0 && !android.support.design.a.isTextEmpty(this.am)) {
                            this.mArticle.articleUrl = this.am;
                        }

                        if (this.mNewDetailViewHolder != null) {
                            this.a(this.mNewDetailViewHolder.mWebView);
                        }

                        boolean v13 = android.support.design.a.isTextEmpty(v7);
                        boolean v9_1 = NetworkUtils.isNetworkAvailable(this.mContext);
                        NewDetailViewHolder v10_2 = this.mNewDetailViewHolder;
                        String v6_1 = this.mArticleDetail != null ? this.mArticleDetail.wendaExtra : "";
                        this.a(v10_2, v7, v8, v6_1);
                        long v10_3 = System.currentTimeMillis();
                        v6_2 = ((long) this.mAppData.mArticleExpireSeconds);
                        if (v19.expireSeconds > 0) {
                            v6_2 = v19.expireSeconds;
                        }

                        if (v6_2 <= 0 || v6_2 > 3600) {
                            v6_2 = 600;
                        }

                        long v20 = v10_3 - v19.timestamp;
                        if (Logger.debug()) {
                            Logger.v(TAG, "check refresh: " + v10_3 + " - " + v19.timestamp + " = " + v20 + "  " + 1000 * v6_2);
                        }

                        if (v20 > v6_2 * 1000 && (v9_1)) {
                            this.aL.a(this.mArticle.getItemKey(), this.mArticle, this.mArticle);
                        }

                        this.f(this.mArticle);
                        this.G();
                        if (this.mNewDetailViewHolder.m) {
                            this.o = System.currentTimeMillis();
                            this.p = new BaseArticle(this.mArticle.groupId, this.mArticle.itemId, this.mArticle.aggrType);
                            this.q = this.s;
                        }

                        if ((this.r) && !v13) {
                            NewDetailViewHolder v20_1 = this.mNewDetailViewHolder;
                            Article v21 = this.mArticle;
                            long v22 = this.s;
                            this.o = 0;
                            this.p = null;
                            if (v21 != null) {
                                if (v20_1 != null && (v20_1.l)) {
                                    this.e(v21);
                                }

                                if (v20_1 == null) {
                                } else if (!v20_1.m) {
                                } else {
                                    this.o = System.currentTimeMillis();
                                    this.p = new BaseArticle(v21.groupId, v21.itemId, v21.aggrType);
                                    this.q = v22;
                                }
                            }

                            if (!this.r && v21 != null && v20_1 != null && !v20_1.m) {
                                this.a(v20_1, v21, v22);
                            }

                            v6_3 = 1;
                            if (v20_1 != null && (v20_1.hasArticleUrl(v21))) {
                                int v7_1 = v20_1.mWebView.getProgress();
                                if (v7_1 > 0 && v7_1 < 100) {
                                    this.b(v7_1);
                                    v6_3 = 0;
                                }
                            }

                            if (v6_3 != 0) {
                                this.q();
                            }

                            CommentTabCache v6_4 = this.a(this.c, this.mNewDetailViewHolder);
                            if (v20_1 == null) {
                            } else if (v20_1 == null) {
                            } else if (v6_4 == null) {
                            } else {

                                v20_1.mNewDetailPageExtra.setArticle(v21);
                                ArticleTabComment v8_1 = v6_4.mArticleTabComments[0];
                                if (v8_1.hasComment) {
                                    if (v6_4.load[0]) {
                                        v20_1.mFooter.switchToLoading();
                                    } else if (v8_1.isEmpty()) {
                                        v20_1.mFooter.hideFooterContent();
                                        boolean v6_5 = v8_1.banComment;
                                        if (!v6_5 && v21 != null) {
                                            v6_5 = v21.mBanComment;
                                        }

                                        NewDetailPageExtra v7_2 = v20_1.mNewDetailPageExtra;
                                        v6_5 = !v6_5 ? true : false;
                                        v7_2.setSofaLayoutVisibility(v6_5);
                                    } else {
                                        if (v8_1.hasMore) {
                                            v20_1.mFooter.switchToMoreContent();
                                        } else {
                                            v20_1.mFooter.hideFooterContent();
                                        }
                                    }

                                    v20_1.mNewDetailAdapter.addAllComment(v8_1.commentWrapperList);
                                    v20_1.mNewDetailAdapter.notifyDataSetChanged();
                                } else {
                                    if (v21 == null) {
                                        v20_1.mFooter.hideFooterContent();
                                    } else if (!NetworkUtils.isNetworkAvailable(this.mContext)) {
                                        this.K();
                                    } else if (v6_4.load[0]) {
                                        v20_1.mFooter.switchToLoading();
                                    } else {
                                        v7_3 = new CommentFetcher(v8_1.increateCounter(), v21, 0, 0, 0);
                                        this.aL.a(v7_3.getItemKey(), v7_3);
                                        v6_4.load[0] = true;
                                        v20_1.mFooter.switchToLoading();
                                        this.a(0);
                                    }

                                    v20_1.mNewDetailAdapter.addAllComment((List) null);
                                    v20_1.mNewDetailAdapter.notifyDataSetChanged();
                                }
                            }
                        }

                        if (this.mArticleShareHelper == null) {
                        } else {
                            this.mArticleShareHelper.mArticleDetail = v19;
                        }
                    }
                }

                if (arg26.m) {
                    v6_2 = System.currentTimeMillis();
                    if (arg27 != null && v6_2 - arg27.clickTimestamp < 60000) {
                        this.e(arg27);
                    }

                    if (this.o > 0) {
                    } else {
                        this.o = v6_2;
                        this.p = new BaseArticle(v14, v16, v18);
                        this.q = arg28;
                    }
                }

                arg26.mNewDetailPageExtra.setArticle(arg27);
                this.d(arg27);
                if (arg27 == null) {
                    return;
                }

                if (this.d()) {
                    return;
                }

                CommentTabCache v14_1 = this.a(arg27.groupId, arg26);
                v6_3 = System.currentTimeMillis() - v14_1.mArticleTabComments[0].h > 600000 ? 1 : 0;
                if (v6_3 == 0) {
                    return;
                }

                long v12 = 0;
                if (arg27.groupId > 0 && arg27.groupId == this.S && !this.V) {
                    v12 = this.T;
                    this.V = true;
                }

                v7_3 = new CommentFetcher(v14_1.mArticleTabComments[0].increateCounter(), arg27, 0, 0, v12);
                this.aL.a(v7_3.getItemKey(), v7_3);
                v14_1.load[0] = true;
                this.a(v12);
                if (arg26 == null) {
                    return;
                }

                if (!NetworkUtils.isNetworkAvailable(this.mContext)) {
                    return;
                }

                if (arg26.mNewDetailAdapter.getCount() != 0) {
                    return;
                }

                arg26.mFooter.switchToLoading();
            } else if (!this.s()) {
                ((NewAnswerDetailActivity) this.getActivity()).b(arg27);
            }
        }
    }

    private void a(NewDetailViewHolder arg21, String arg22, String arg23, String arg24) {
        boolean v2_5;
        JSONObject v2_4;
        JSONException v4_2;
        JSONObject v4_1;
        String v4;
        if (arg21 != null && this.mArticle != null) {
            arg21.l = false;
            arg21.m = true;
            ++arg21.token;
            arg21.mDetailScrollView.setVisibility(View.VISIBLE);
            Article v11 = this.mArticle;
            if (v11 == null) {
                return;
            }

            this.e(v11);
            if (arg21 != null) {
                Article v2 = this.mArticle;
                if ((this.isActive()) && v2 != null) {
                    if (this.p == null || this.p.groupId != v2.groupId) {
                        this.w();
                        this.o = 0;
                        this.p = new BaseArticle(v2.groupId, v2.itemId, v2.aggrType);
                    }

                    this.q = this.s;
                    if (this.o > 0) {
                    } else {
                        this.o = System.currentTimeMillis();
                    }
                }
            }

            String v3 = "file:///android_asset/article/?item_id=" + v11.groupId + "&token=" + arg21.token;
            String v2_1 = this.mAppData.getSSJSResAssetsDir() + "/v55";
            v2_1 = new File(v2_1).exists() ? "file://" + v2_1 + "/" : "v55/";
            if (android.support.design.a.isTest(this.getContext())) {
                v4 = AppData.getInstance().aI;
                if (!android.support.design.a.isTextEmpty(v4)) {
                    v2_1 = v4;
                }
            }

            String v12 = v2_1 + "js/android.js";
            String v13 = v2_1 + "css/android.css";
            String v14 = v2_1 + "js/lib.js";
            StringBuilder v15 = new StringBuilder();
            if (Logger.debug()) {
                Logger.v(TAG, "bindContent for " + v11.groupId + " " + v2_1);
            }

            int v5 = this.mAppData.mLoadImagePref;
            NetworkType v16 = NetworkUtils.getNetworkType(this.mContext);
            v4 = "thumb";
            int v2_2 = 1;
            if (v16 == NetworkType.NONE) {
                v2_2 = 0;
                v4 = "none";
            } else {
                if (v16 != NetworkType.WIFI && v5 != 1) {
                    if (v5 == 2) {
                        v4 = "none";
                        v2_2 = 0;
                    } else {
                    }
                } else {
                    v4 = "origin";
                }
            }

            arg21.mDetailScrollView.setEnableDetectContentSizeChange("thumb".equals(v4));
            v5 = 0;
            int v6 = 0;
            if (v11.userDigg) {
                v5 = 1;
            }

            if (v11.userBury) {
                v6 = 1;
            }

            int v8 = this.aI;
            String v7 = "m_" + (((int) UIUtils.sp2px(this.getContext(), ((float) ArticleConstants.K[0]))));
            if (v8 == 1) {
                v7 = "s_" + (((int) UIUtils.sp2px(this.getContext(), ((float) ArticleConstants.K[1]))));
            } else if (v8 == 2) {
                v7 = "l_" + (((int) UIUtils.sp2px(this.getContext(), ((float) ArticleConstants.K[2]))));
            } else if (v8 == 3) {
                v7 = "xl_" + (((int) UIUtils.sp2px(this.getContext(), ((float) ArticleConstants.K[3]))));
            }

            v15.append("<html><head>");
            v15.append("<meta name=\"viewport\" content=\"width=device-width, user-scalable=no, initial-scale=1.0\" >\n");
            if (AppData.isNightMode()) {
                v15.append("<meta name=\"night_mode\" content=\"1\" >\n");
            }

            v8 = 0;
            if (NetworkUtils.isNetworkAvailable(this.mContext)) {
                v8 = 1;
            }

            String v9 = null;
            int v10 = this.mAppData.getAppContext().getAid();
            if (v10 != 13 && v10 > 0) {
                v9 = "content://com.ss.android.article.base.ImageProvider" + v10 + "/";
            }

            int v17 = this.mAppData.lazyLoadPolicy;
            v10 = 0;
            if (v17 == 1 || v17 == 2) {
                if (v17 == 2 && (v16 == NetworkType.MOBILE_3G || v16 == NetworkType.WIFI)) {
                    v10 = 1;
                }

                if (v17 != 1) {
                } else if (v16 != NetworkType.WIFI) {
                } else {

                    v10 = 1;
                }
            }

            v15.append("<meta name=\"show_avatar\" content=\"").append(v2_2).append("\" >\n");
            v15.append("<meta name=\"show_video\" content=\"").append(v8).append("\" >\n");
            v15.append("<meta name=\"load_image\" content=\"").append(v4).append("\" >\n");
            v15.append("<meta name=\"digg_count\" content=\"").append(v11.diggCount).append("\" >\n");
            v15.append("<meta name=\"bury_count\" content=\"").append(v11.buryCount).append("\" >\n");
            v15.append("<meta name=\"user_digg\" content=\"").append(v5).append("\" >\n");
            v15.append("<meta name=\"user_bury\" content=\"").append(v6).append("\" >\n");
            v15.append("<meta name=\"font_size\" content=\"").append(v7).append("\" >\n");
            v15.append("<meta name=\"group_id\" content=\"").append(v11.groupId).append("\" >\n");
            v15.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
            v15.append(v13);
            v15.append("\" />\n");
            if (v9 != null || v10 != 0) {
                v15.append("<script type=\"text/javascript\">\n");
                if (v9 != null) {
                    v15.append("  var url_prefix = \"" + v9 + "\";\n");
                }

                if (v10 != 0) {
                    v15.append("  var close_lazyload = true;\n");
                }

                v15.append("</script>\n");
            }

            v15.append("</head><body>");
            v15.append(arg22);
            if (android.support.design.a.isTextEmpty(arg23)) {
                arg23 = "{}";
            }

            JSONObject v5_1 = null;
            try {
                v4_1 = new JSONObject(arg23);
                v4_1.put("is_subscribed", SubscribeManager.getInstance().a(this.mArticleDetail.mediaId, this.mArticle.ah));
                if (!this.mSpipe.isLogin) {
                    v2_5 = false;
                } else if (this.mSpipe.pgcMediaid == this.mArticleDetail.mediaId) {
                    v2_5 = true;
                } else {
                    v2_5 = false;
                }
                v4_1.put("is_author", v2_5);
                v4_1.put("gid", this.mArticle.groupId);
                v4_1.put("item_id", this.mArticle.itemId);
                v2_1 = this.mAppData.getAppSettings().getH5Settings();
                if (!android.support.design.a.isTextEmpty(v2_1)) {
                    v4_1.put("h5_settings", new JSONObject(v2_1).toString());
                }

                Context v2_6 = this.mContext.getApplicationContext();
                if ((v2_6 instanceof BizApplication)) {
                    v4_1.put("ab_client", ((BizApplication) v2_6).getAbClient());
                }

                v4_1.put("is_lite", 1);
                v2_4 = v4_1;
                StringBuilder v4_3 = v15.append("<script type=\"text/javascript\">window.h5_extra = ");
                if (v2_4 != null) {
                    arg23 = v2_4.toString();
                }

                v4_3.append(arg23).append("; </script>");
                if (!android.support.design.a.isTextEmpty(arg24)) {
                    v15.append("<script type=\"text/javascript\">window.wenda_extra = ").append(JsonUtil.a(JsonUtil.a(arg24, "enter_from", this.J().optString("enter_from")), "list_schema", this.t())).append("; </script>");
                }

                if (this.mArticle.zzcomment != null && !this.mArticle.zzcomment.isEmpty()) {
                    JSONArray v4_4 = new JSONArray();
                    Iterator v5_2 = this.mArticle.zzcomment.iterator();
                    while (v5_2.hasNext()) {
                        v4_4.put(((Comment) v5_2.next()).toAbstractJSON());
                    }

                    v15.append("<script type=\"text/javascript\">window.zz_comments = ").append(v4_4.toString()).append("; </script>");
                }

                v15.append("<script type=\"text/javascript\" src=\"");
                v15.append(v14);
                v15.append("\"></script>");
                v15.append("<script type=\"text/javascript\" src=\"");
                v15.append(v12);
                v15.append("\" ></script>");
                v15.append("</body></html>");
                arg21.mWebView.loadDataWithBaseURL(v3, v15.toString(), "text/html", "utf-8", v3);
                arg21.mWebView.setTag(com.ss.android.article.browser.R.id.webview_transform_key, Boolean.TRUE);
                arg21.mWebView.setTag(com.ss.android.article.browser.R.id.webview_client_transform_key, null);
                arg21.mWebView.setTag(com.ss.android.article.browser.R.id.webview_support_js, null);
                arg21.mWebView.setTag(com.ss.android.article.browser.R.id.webview_clear_history_key, v3);
                this.aP = true;
                this.e(v3);
            } catch (JSONException v2_3) {
                v2_3.printStackTrace();
            }
        }
    }

    private void a(NewDetailViewHolder arg5, boolean arg6) {
        int v3 = com.ss.android.article.browser.R.color.gq;
        if (arg5 != null && arg5.isNightMode != arg6) {
            arg5.isNightMode = arg6;
            arg5.mNewDetailPageExtra.mSofaText.setTextColor(this.F.getColor(com.ss.android.article.browser.R.color.ssxinzi3));
            arg5.mMoreTextView.setTextColor(this.getResources().getColor(com.ss.android.article.browser.R.color.ly));
            arg5.mMoreTextView.setBackgroundResource(com.ss.android.article.browser.R.color.qm);
            if (arg5.mFooter.mFooterTopDivider != null) {
                arg5.mFooter.mFooterTopDivider.setBackgroundResource(v3);
            }

            if (arg5.mFooter.mFooterBottomDivider == null) {
                return;
            }

            arg5.mFooter.mFooterBottomDivider.setBackgroundResource(v3);
        }
    }

    private void a(BaseAdsData arg4) {
        if (arg4 != null && (arg4.isValid())) {
            BaseAdsData.trackAdShow(this.mContext, "detail_ad", arg4, 0);
        }
    }

    static void a(NewAnswerDetailFragment arg4, Comment arg5) {
        if (arg5 != null) {
            NewDetailViewHolder v0 = arg4.mNewDetailViewHolder;
            if (v0 != null && v0.mCommentTabCache != null) {
                if (v0.mCommentTabCache.removeCommnet(arg5.commentId)) {
                    v0.mNewDetailAdapter.addAllComment(v0.mCommentTabCache.mArticleTabComments[0].commentWrapperList);
                    v0.mNewDetailAdapter.notifyDataSetChanged();
                    arg4.a(arg4.mNewDetailViewHolder, arg4.mNewDetailViewHolder.mCommentTabCache);
                }

                UpdateItemMgr.getInstance(arg4.getContext()).deleteComment(arg5.commentId);
            }
        }
    }

    static void a(NewAnswerDetailFragment arg0, NewDetailViewHolder arg1) {
        arg0.f(arg1);
    }

    private void a(String arg8, BaseArticle arg9, long arg10) {
        this.a(arg8, arg9, arg10, null);
    }

    private void a(String arg10, BaseArticle arg11, long arg12, JSONObject arg14) {
        JSONObject v8;
        long v4 = 0;
        String v3 = this.R;
        if (!android.support.design.a.isTextEmpty(arg10)) {
            long v6 = arg11 != null ? arg11.itemId : v4;
            int v0 = arg11 != null ? arg11.aggrType : 0;
            if (arg14 == null) {
                v8 = new JSONObject();
            } else {
                v8 = arg14;
            }

            try {
                if (!v8.has("item_id")) {
                    v8.put("item_id", v6);
                }

                if (v8.has("aggr_type")) {
                } else {
                    v8.put("aggr_type", v0);
                }
            } catch (Exception v0_1) {
            }

            Context v1 = this.getContext();
            if (arg11 != null) {
                v4 = arg11.groupId;
            }

            MobClickCombiner.onEvent(v1, arg10, v3, v4, arg12, v8);
        }
    }

    private void a(String arg10, JSONObject arg11, BaseArticle arg12) {
        String v0_1;
        long v6 = 0;
        JSONObjectWrapper v3 = new JSONObjectWrapper();
        String v2 = this.R;
        String v1 = this.y;
        long v4 = arg12 != null ? arg12.itemId : v6;
        int v0 = arg12 != null ? arg12.aggrType : 0;
        v3.put("item_id", Long.valueOf(v4)).put("aggr_type", Integer.valueOf(v0)).put("log_pb", this.z);
        if (android.support.design.a.isTextEmpty(v2)) {
            v0_1 = v1;
            v1 = v2;
        } else if (v2.equals("click_" + this.y)) {
            v1 = "click_category";
            v0_1 = this.y;
        } else if (v2.equals("click_headline")) {
            v0_1 = this.y;
            v1 = v2;
        } else {
            v0_1 = v2.replaceFirst("click_", "");
            v1 = v2;
        }

        v3.put("enter_from", v1).put("category_name", v0_1);
        if (AppData.getInstance().getAbSettings().isApplogStaging()) {
            v3.put("_staging_flag", Integer.valueOf(1));
        }

        if (this.A != v6) {
            v3.put("search_result_id", Long.valueOf(this.A)).put("source", this.B).put("query", this.C);
        }

        v3.put(arg11);
        android.support.design.a.onEvent(arg10, v3.jo);
    }

    private static void a(List arg5) {
        if (arg5 != null && arg5.size() != 0) {
            int v1;
            for (v1 = 0; v1 < arg5.size(); ++v1) {
                Object v0 = arg5.get(v1);
                ((CommentWrapper) v0).e = 0;
                if (((CommentWrapper) v0).cellType != 1 && v1 > 0) {
                    v0 = arg5.get(v1 - 1);
                    if (((CommentWrapper) v0).cellType == 1) {
                        ((CommentWrapper) v0).e = 1;
                    }
                }

                if (v1 == arg5.size() - 1) {
                    ((CommentWrapper) arg5.get(v1)).e = 2;
                }
            }
        }
    }

    private void a(boolean arg7) {
        ArticleInfo v0 = null;
        if (this.mArticleShareHelper != null) {
            this.mArticleShareHelper.v = arg7;
        }

        Article v1 = this.mArticle;
        if (this.mArticleShareHelper != null && v1 != null) {
            if (arg7) {
                if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mNewDetailPageExtra != null) {
                    v0 = this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo;
                }

                switch (this.getCommentMode()) {
                    case 1:
                    case 2: {
                        break;
                    }
                    default:
                        this.mArticleShareHelper.b(v1, v0, this.s);
                        return;
                }
                this.mArticleShareHelper.mCategoryName = this.y;
                this.mArticleShareHelper.c(v1, v0, this.s);
            } else {
                this.mArticleShareHelper.mCategoryName = this.y;
                this.mArticleShareHelper.mArticleDetail = this.mArticleDetail;
                if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mNewDetailPageExtra != null) {
                    v0 = this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo;
                }

                this.mArticleShareHelper.l = v0;
                this.mArticleShareHelper.a(v1, this.s, true);
            }
        }
    }

    private void a(boolean arg5, int arg6, boolean arg7) {
        if (!this.s()) {
            NewDetailViewHolder v2 = this.mNewDetailViewHolder;
            if (v2 == null) {
                return;
            }

            int v0 = v2.mListView.getHeaderViewsCount();
            Article v3 = this.mArticle;
            if (v3 != null && (v3.disableScrollOver()) && (arg7)) {
                arg6 = 2;
            }

            switch (arg6) {
                case 4: {
                    v0 = 1;
                    break;
                }
            }

            try {
                v2.mListView.setSelection(v0);
            } catch (Exception v0_1) {
            }

            if (v2.mNewDetailAdapter.h) {
                v2.mNewDetailAdapter.h = false;
            }

            if (arg5) {
                this.as = true;
                v2.mDetailScrollView.checkOpenDrawer();
            } else {
                this.x();
            }
        }
    }

    static int[] a(NewAnswerDetailFragment arg0, int[] arg1) {
        arg0.aV = arg1;
        return arg1;
    }

    public final Response checkResponse(String arg2) {
        return null;
    }

    public final void onReceivedError(int errorCode, String description) {
        if (Logger.debug()) {
            Logger.v(TAG, "onReceivedError " + errorCode + " " + description);
        }

        if (!this.s()) {
            NewDetailViewHolder v0 = this.mNewDetailViewHolder;
            if (v0 != null) {
                v0.mWapStatHelper.onReceivedError(errorCode);
            }
        }
    }

    public final void onRemoteImageLoaded(long itemId, int index, boolean validResult, boolean isOrigin) {
        if (!this.s() && itemId > 0 && index >= 0) {
            if (Logger.debug()) {
                Logger.v(TAG, "onRemoteImageLoaded " + itemId + " " + index + " " + validResult + " " + isOrigin);
            }

            NewDetailViewHolder v2 = this.mNewDetailViewHolder;
            if (v2 == null) {
                return;
            }

            long v0 = this.mArticle != null ? this.mArticle.groupId : this.c;
            if (Logger.debug()) {
                Logger.v(TAG, "== check image_load_cb " + itemId + " " + index + " " + v0 + " " + v2.l);
            }

            if (v0 != itemId) {
                return;
            }

            if (!v2.m) {
                return;
            }

            StringBuilder v1 = new StringBuilder();
            v1.append("javascript:image_load_cb(");
            v1.append(index);
            StringBuilder v3 = v1.append(", ");
            String v0_1 = validResult ? "true" : "false";
            v3.append(v0_1);
            v3 = v1.append(", ");
            v0_1 = isOrigin ? "true" : "false";
            v3.append(v0_1);
            v1.append(")");
            LoadUrlUtils.loadUrl(v2.mWebView, v1.toString());
        }
    }

    public final void onShowCustomView(View arg5, WebChromeClient.CustomViewCallback customViewCallback) {
        if (this.ag) {
            try {
                if (this.ae != null) {
                    customViewCallback.onCustomViewHidden();
                    return;
                }

                this.mCustomViewCallback = customViewCallback;
                this.mFullscreenVideoFrame.addView(arg5);
                UIUtils.requestActivityOrientation(this.getActivity(), true);
                this.ae = arg5;
                this.mFullscreenVideoFrame.setVisibility(View.VISIBLE);
                this.mFullscreenVideoFrame.requestFocus();
            } catch (Throwable v0) {
                Logger.e(TAG, "exception in : client_onHideCustomView : " + v0.toString());
            }
        }
    }

    public final void onProgressChanged(WebView webView, int progress) {
        if (!this.s()) {
            NewDetailViewHolder v0 = this.mNewDetailViewHolder;
            if (v0 != null && v0.mWebView == webView) {
                if (progress >= 100) {
                    this.q();
                } else {
                    this.b(progress);
                }
            }
        }
    }

    public final void onPageStarted(WebView webView, String url) {
        boolean v0 = false;
        if (Logger.debug()) {
            Logger.v(TAG, "onPageStarted " + url + " " + webView.getOriginalUrl());
        }

        NewDetailViewHolder v1 = this.mNewDetailViewHolder;
        if (v1 != null) {
            v1.l = false;
        }

        if (v1 != null && this.mArticle != null) {
            if (!v1.isWebViewClientTransform()) {
                v0 = true;
            }

            if (url.startsWith("file:///android_asset/article/")) {
                v1.mWapStatHelper.onPageStarted(webView, url, v0, url);
                return;
            }

            v1.mWapStatHelper.onPageStarted(webView, url, v0, this.mArticle.articleUrl);
        }
    }

    public final void onCommentLoaded(CommentFetcher arg13, boolean arg14) {
        if (!this.s() && arg13 != null && arg13.article != null && arg13.a == this.mNewDetailViewHolder.mCommentTabCache.mArticleTabComments[arg13.tabIndex].counter) {
            int v0 = arg13.tabIndex != 0 || (this.d()) ? 0 : 1;
            long v2 = arg13.article.groupId;
            long v4 = arg13.article.itemId;
            if (Logger.debug()) {
                Logger.d(TAG, "onCommentLoaded " + v2 + " " + arg13.tabIndex + " " + arg13.offset + " " + arg14);
            }

            NewDetailViewHolder v6 = this.mNewDetailViewHolder;
            v6.mCommentTabCache.load[arg13.tabIndex] = false;
            if (!arg14) {
                if (v6 == null) {
                    return;
                }

                if (v0 == 0) {
                    return;
                }

                if (arg13.errorCode == 12) {
                    this.K();
                    return;
                }

                v6.mFooter.switchToError(com.ss.android.article.browser.R.string.ss_error_unknown);
                return;
            }

            ArticleTabComment v7 = this.mNewDetailViewHolder.mCommentTabCache.mArticleTabComments[arg13.tabIndex];
            if (v7.h <= 0) {
                v7.h = System.currentTimeMillis();
            }

            v7.copyAllComment(arg13.articleTabComment, 1);
            a(v7.commentWrapperList);
            v7.offset += arg13.j;
            if (v7.commentWrapperList.isEmpty()) {
                v7.hasMore = false;
            }

            int v1 = v7.commentWrapperList.size() == 0 ? 1 : 0;
            if (v1 == 0) {
                if (v0 == 0) {
                } else if ((v7.detailNoComment) && !v6.everEnterComment) {
                    v6.mFooter.setViewMoreText(com.ss.android.article.browser.R.string.label_click_to_view_comments);
                    v6.mFooter.switchToMoreContent();
                } else {
                    v6.mFooter.setViewMoreText(com.ss.android.article.browser.R.string.ss_load_more);
                    if (v7.hasMore) {
                        v6.mFooter.switchToMoreContent();
                    } else {
                        v6.mFooter.hideFooterContent();
                    }
                }
            } else if (v0 != 0) {
                v6.mFooter.hideFooterContent();
                v1 = (v7.banComment) || (arg13.article.mBanComment) ? 1 : 0;
                NewDetailPageExtra v8 = v6.mNewDetailPageExtra;
                boolean v1_1 = v1 == 0 ? true : false;
                v8.setSofaLayoutVisibility(v1_1);
            }

            if (v0 != 0) {
                v1 = 0;
                if (!v7.detailNoComment || (v6.everEnterComment)) {
                    v6.mNewDetailAdapter.addAllComment(v7.commentWrapperList);
                    if (arg13.topCommentId > 0) {
                        v1 = 1;
                    }
                } else {
                    v6.mNewDetailAdapter.addAllComment((List) null);
                }

                v6.mNewDetailAdapter.i = false;
                v6.mNewDetailAdapter.notifyDataSetChanged();
                if (v1 == 0) {
                } else {
                    v1 = v6.mListView.getHeaderViewsCount();
                    try {
                        v6.mListView.setSelection(v1);
                    } catch (Exception v1_2) {
                    }
                }
            }

            if (v7.totalNumber >= 0 && arg13.article != null) {
                if (v7.totalNumber < v7.commentWrapperList.size()) {
                    v7.totalNumber = v7.commentWrapperList.size();
                }

                if (arg13.article.commentCount == v7.totalNumber) {
                } else {
                    arg13.article.commentCount = v7.totalNumber;
                    DBHelper.getInstance(this.mContext).a(v2, v4, v7.totalNumber);
                    NewDetailViewHolder v1_3 = this.mNewDetailViewHolder;
                    Article v2_1 = this.mArticle;
                    if (v1_3 == null) {
                    } else if (v2_1 == null) {
                    } else if (v2_1 != arg13.article) {
                    } else {
                        if (v7.banComment) {
                            arg13.article.mBanComment = true;
                        }

                        if (v0 == 0) {
                        } else {
                            this.c(v2_1);
                        }
                    }
                }
            }

            if (v0 != 0 && (this.M)) {
                this.M = false;
                if (!android.support.design.a.isTextEmpty(this.aR)) {
                    MobClickCombiner.onEvent(this.getContext(), "enter_comment", this.aR);
                }

                this.a(true, 4, true);
            }

            if (this.N) {
                this.N = false;
                this.p();
            }
        }
    }

    public final void onArticleInfoLoaded(Article article, ArticleInfo articleInfo) {
        int v0_1;
        int v4 = -1;
        String v9 = null;
        if (!this.s() && article != null && article == this.mArticle) {
            if (articleInfo == null) {
                long v0 = article.groupId;
                if (Logger.debug()) {
                    UIUtils.showImageToast(this.mContext, com.ss.android.article.browser.R.drawable.close_popup_textpage, "load info failed: " + v0);
                }
            } else {
                if (Logger.debug()) {
                    Logger.d(TAG, "onArticleInfoLoaded " + articleInfo.itemId);
                }

                this.aJ.put(Long.valueOf(articleInfo.itemId), articleInfo);
                this.ah = articleInfo.webViewTrackKey;
                NewDetailViewHolder v8 = this.mNewDetailViewHolder;
                if (v8 != null && !android.support.design.a.isTextEmpty(this.ah)) {
                    v8.mWapStatHelper.mWebViewTrackKey = this.ah;
                }

                if (articleInfo.diggCount < 0 || article.diggCount == articleInfo.diggCount) {
                    articleInfo.diggCount = v4;
                    v0_1 = 0;
                } else {
                    article.diggCount = articleInfo.diggCount;
                    v0_1 = 1;
                }

                if (articleInfo.buryCount < 0 || article.buryCount == articleInfo.buryCount) {
                    articleInfo.buryCount = v4;
                } else {
                    article.buryCount = articleInfo.buryCount;
                    v0_1 = 1;
                }

                if (articleInfo.userDigg) {
                    if ((article.userDigg) || (article.userBury)) {
                        articleInfo.userDigg = false;
                    } else {
                        article.userDigg = true;
                        v0_1 = 1;
                    }

                    articleInfo.userBury = false;
                } else {
                    if (!articleInfo.userBury) {
                    } else if (!article.userDigg && !article.userBury) {
                        article.userBury = true;
                        v0_1 = 1;
                    } else {
                        articleInfo.userBury = false;
                    }
                }

                if ((android.support.design.a.isTextEmpty(articleInfo.shareUrl)) || (articleInfo.shareUrl.equals(article.shareUrl))) {
                    articleInfo.shareUrl = v9;
                } else {
                    article.shareUrl = articleInfo.shareUrl;
                    v0_1 = 1;
                }

                if ((android.support.design.a.isTextEmpty(articleInfo.displayUrl)) || (articleInfo.displayUrl.equals(article.displayUrl))) {
                    articleInfo.displayUrl = v9;
                } else {
                    article.displayUrl = articleInfo.displayUrl;
                    v0_1 = 1;
                }

                if ((android.support.design.a.isTextEmpty(articleInfo.displayTitle)) || (articleInfo.displayTitle.equals(article.displayTitle))) {
                    articleInfo.displayTitle = v9;
                } else {
                    article.displayTitle = articleInfo.displayTitle;
                    v0_1 = 1;
                }

                if (articleInfo.delete) {
                    article.delete = true;
                    article.commentCount = 0;
                }

                if ((articleInfo.banComment) && !article.mBanComment) {
                    article.mBanComment = true;
                    v0_1 = 1;
                }

                if (articleInfo.wendaData != null && (articleInfo.wendaData.isAnswerDelete)) {
                    article.delete = true;
                }

                if (v0_1 != 0 && !articleInfo.delete) {
                    DBHelper.getInstance(this.mContext).updateArticleInfo(articleInfo);
                }

                if (this.mArticle == article) {
                    this.c(article);
                }

                if (v8 != null && this.mArticle == article) {
                    if (article.delete) {
                        if (!this.s()) {
                            ((NewAnswerDetailActivity) this.getActivity()).b(article);
                        } else {
                        }

                        return;
                    } else {
                        if ((!android.support.design.a.isTextEmpty(articleInfo.context) || !android.support.design.a.isTextEmpty(articleInfo.script)) && (v8.l)) {
                            String v0_2 = f(v8.mWebView.getOriginalUrl());
                            v0_1 = v0_2 == null || !v0_2.startsWith("file:///android_asset/article/") ? 0 : 1;
                            if (v0_1 == 0) {
                            } else {
                                this.a(v8, articleInfo, true);
                            }
                        }

                        v8.mNewDetailPageExtra.initExtras(articleInfo, this.s, new ai(this), new aj(this));
                        if (articleInfo.mWendaNextPage != null && articleInfo.mWendaNextPage.next_ansid != null) {
                            long v2 = Long.valueOf(articleInfo.mWendaNextPage.next_ansid).longValue();
                            Article v1 = new Article(v2, v2, 1);
                            this.aL.a(v1.getItemKey(), ((Article) null), ((AbsArticle) v1));
                        }

                        if (articleInfo.mWendaNextPage != null && (articleInfo.mWendaNextPage.show_toast)) {
                            android.support.design.a.showImageToast(this.mContext, com.ss.android.article.browser.R.string.jn, 0);
                        }

                        if (this.aw == null) {
                            this.aw = (NextAnswerView) this.a(com.ss.android.article.browser.R.id.jd);
                            this.aw.setVisibility(View.INVISIBLE);
                        }

                        if (this.aw != null && this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mNewDetailPageExtra != null && this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo != null) {
                            NextAnswerView v0_3 = this.aw;
                            WendaNextPage v1_1 = this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo.mWendaNextPage;
                            View.OnClickListener v2_1 = this.ao;
                            if (v1_1 != null) {
                                if (v1_1.has_next) {
                                    v0_3.a.setOnClickListener(new com.ss.android.wenda.ui.a(v0_3, v1_1));
                                } else {
                                    v0_3.a.setTextColor(v0_3.getResources().getColor(com.ss.android.article.browser.R.color.cg));
                                    v0_3.a.setOnClickListener(new com.ss.android.wenda.ui.b(v0_3));
                                }

                                v0_3.a.setText(v1_1.next_answer_text);
                                v0_3.b.setText(v1_1.all_answer_text);
                                v0_3.b.setOnClickListener(v2_1);
                            }

                            this.az = this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo.mWendaNextPage;
                        }

                        if (this.mArticleDetail == null) {
                        } else if (android.support.design.a.isTextEquals(this.mArticleDetail.etag, articleInfo.etag)) {
                        } else {

                            this.G.deleteArticle(this.mArticle);
                        }
                    }
                }

                this.mNewDetailViewHolder.mNewDetailAdapter.mArticle = this.mArticle;
                if (this.mNewDetailViewHolder != null && articleInfo.wendaData != null) {
                    NewDetailAdapter v0_4 = this.mNewDetailViewHolder.mNewDetailAdapter;
                    v0_4.k = articleInfo.wendaData.canDeleteComment;
                    v0_4.notifyDataSetChanged();
                }

                if (v8 == null) {
                    return;
                }

                v8.mNewDetailPageExtra.d();
            }
        }
    }

    public final void onArticleDetailLoadedWithCache(Article article, ArticleDetail articleDetail) {
        if (article != null && articleDetail != null && article.groupId == articleDetail.itemId) {
            String v0 = articleDetail.content;
            String v1 = articleDetail.h5Extra;
            if (articleDetail.delete) {
                if (!this.s()) {
                    ((NewAnswerDetailActivity) this.getActivity()).b(article);
                }
            } else if (!this.s() && !android.support.design.a.isTextEmpty(v0)) {
                NewDetailViewHolder v2 = this.mNewDetailViewHolder;
                Article v3 = this.mArticle;
                this.mArticleDetail = articleDetail;
                if (v2 != null && v3 != null && v3 == article) {
                    Logger.d(TAG, "rebind content upon refresh: " + v3.groupId);
                    this.a(v2, v0, v1, articleDetail.wendaExtra);
                    this.f(v3);
                    this.G();
                }
            }
        }
    }

    public final void onLoaded(Article article, AbsArticle absArticle, ArticleDetail articleDetail) {
    }

    public final void a(IVideoFullscreen videoFullscreen) {
    }

    public final void onLoaded(String arg1, long arg2, Response response) {
    }

    public final void onArticleDetailLoadedFromInternet(String arg2, Article article, ArticleDetail articleDetail) {
        if (!this.isDestroyed()) {
            ((NewAnswerDetailActivity) this.getActivity()).onArticleDetailLoadedFromInternet(arg2, article, articleDetail);
        }
    }

    final void a(String arg11, String arg12, String arg13) {
        JSONObject v5;
        JSONObject v1;
        long v8 = 0;
        String v0 = null;
        if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mWebView != null) {
            v0 = this.mNewDetailViewHolder.mWebView.getUrl();
        }

        if (this.s <= v8 && !android.support.design.a.isTextEmpty(v0) && !this.mAppData.j(v0)) {
            v1 = new JSONObject();
            JSONObject v2 = new JSONObject();
            try {
                v2.put("url", arg11);
                v2.put("referer_url", v0);
                v1.put("label", "browser");
                v1.put("ext_json", v2);
            } catch (JSONException v0_1) {
            }

            AppUtil.reportAppDownloadBanned(this.getContext(), v1);
            return;
        }

        try {
            v5 = new JSONObject();
            v1 = new JSONObject();
            try {
                v1.put("url", arg11);
                v1.put("ad_id", this.s);
                if (!android.support.design.a.isTextEmpty(v0)) {
                    v1.put("referer_url", v0);
                }

                if (this.mArticle != null) {
                    v1.put("group_id", this.mArticle.groupId);
                    v1.put("item_id", this.mArticle.itemId);
                    v1.put("aggr_type", this.mArticle.aggrType);
                    if (!android.support.design.a.isTextEmpty(v0) && !v0.equals(this.mArticle.articleUrl)) {
                        v1.put("init_url", this.mArticle.articleUrl);
                    }
                }

                if (this.s <= v8) {
                    v1.put("in_white_list", 1);
                }

                v5.put("label", "browser");
                v5.put("ext_json", v1);
            } catch (JSONException v0_1) {
            }
            AppUtil.a(this.mContext, this.mAppData, arg11, arg12, arg13, v5, new long[1]);
        } catch (Exception v0_2) {
            Logger.w(TAG, "handleDownload exception " + arg11 + " : " + v0_2);
        }
    }

    public final void queryContextData(String key, HashMap arg4) {
        if ("cid".equals(key)) {
            arg4.put(key, Long.valueOf(this.s));
        } else if ("log_extra".equals(key)) {
            arg4.put(key, this.b);
        }
    }

    public final void shareToWeChat(String arg4, JSONObject arg5) {
        this.mArticleShareHelper.position = arg4;
        this.mArticleShareHelper.fillShareParams(arg5);
        this.mArticleShareHelper.share(2, this.mArticle);
    }

    public final void startThumbPreviewActivity(List arg3, int arg4) {
        this.n = false;
        ThumbPreviewActivity.startActivity(this.getContext(), android.support.design.a.imageInfoList2ImageList(arg3), arg4);
    }

    public final boolean a(Article article) {
        return false;
    }

    public final boolean a(Article article, int arg3) {
        return false;
    }

    static void b(NewDetailViewHolder arg0) {
        c(arg0);
    }

    static boolean b(NewAnswerDetailFragment arg1) {
        return arg1.ar;
    }

    public final void report(String event) {
        MobClickCombiner.onEvent(this.getContext(), "detail", event);
    }

    public final void onHideCustomView() {
        WebChromeClient.CustomViewCallback v1 = null;
        if (this.ae == null) {
            this.mCustomViewCallback = v1;
            return;
        }

        try {
            this.mFullscreenVideoFrame.setVisibility(View.GONE);
            this.mFullscreenVideoFrame.removeView(this.ae);
            UIUtils.requestActivityOrientation(this.getActivity(), false);
            this.ae = null;
            this.mCustomViewCallback.onCustomViewHidden();
        } catch (Throwable v0) {
            Logger.e(TAG, "exception in : client_onHideCustomView : " + v0.toString());
        }
    }

    private void b(int arg3) {
        this.H.setProgress(arg3);
        this.mWeakHandler.removeMessages(14);
        try {
            if (this.H.getVisibility() == View.VISIBLE) {
                return;
            }

            Animation v0_1 = AnimationUtils.loadAnimation(this.mContext, android.R.anim.fade_in);
            if (v0_1 == null) {
                return;
            }

            this.H.startAnimation(v0_1);
            this.H.setVisibility(View.VISIBLE);
        } catch (Throwable v0) {
        }
    }

    static int b(NewAnswerDetailFragment arg0, int arg1) {
        arg0.aO = arg1;
        return arg1;
    }

    private void b(Article arg12) {
        int v10;
        int v0_1;
        JSONObject v9 = null;
        if (arg12 != null) {
            Iterator v3 = this.aX.values().iterator();
            Object v1 = v9;
            while (v3.hasNext()) {
                Object v0 = v3.next();
                if (((q$a) v0).e == 0) {
                    v1 = v0;
                }

                if (!Logger.debug()) {
                    continue;
                }

                Logger.v(TAG, "== " + ((q$a) v0).e + " " + ((q$a) v0).url + " " + ((q$a) v0).precentage + " " + ((q$a) v0).screencount);
            }

            if (v1 == null || ((q$a) v1).url == null) {
                label_116:
                v0_1 = 0;
                v10 = 0;
            } else {
                if (!((q$a) v1).url.startsWith("file:///android_asset/article/") && !((q$a) v1).url.equals(arg12.articleUrl)) {
                    v0_1 = 0;
                    v10 = 0;
                } else {
                    int v2 = Math.round(((q$a) v1).precentage * 100f);
                    v0_1 = ((q$a) v1).screencount;
                    v10 = v2;
                }
            }

            String v3_1 = this.R;
            if (AppData.getInstance().getAbSettings().isAppLogOld()) {
                try {
                    JSONObject v8 = new JSONObject();
                    v8.put("pct", v10);
                    v8.put("page_count", v0_1);
                    v8.put("item_id", arg12.itemId);
                    v8.put("aggr_type", arg12.aggrType);
                    this.getContext();
                    AppLog.onEvent("article", "read_pct", v3_1, arg12.groupId, this.s, v8);
                } catch (JSONException v1_1) {
                }
            }

            if (!AppData.getInstance().getAbSettings().isAppLogNew()) {
                return;
            }

            try {
                JSONObject v1_2 = android.support.design.a.isTextEmpty(this.P) ? new JSONObject() : new JSONObject(this.P);
                if (this.q > 0) {
                    v1_2.put("ad_id", this.q);
                    v1_2.put("group_id", arg12.groupId);
                }

                v1_2.put("percent", v10);
                v1_2.put("page_count", v0_1);
                v9 = v1_2;
            } catch (Exception v0_2) {
            }

            this.a("read_pct", v9, new BaseArticle(arg12.groupId, arg12.itemId, arg12.aggrType));
        }
    }

    static void b(NewAnswerDetailFragment arg0, NewDetailViewHolder arg1) {
        arg0.checkAndReportLikeAndRewardsShow(arg1);
    }

    static boolean b(NewAnswerDetailFragment arg0, boolean arg1) {
        arg0.ak = arg1;
        return arg1;
    }

    public final void onPageFinished(WebView webView, String url) {
        boolean v1 = false;
        int v0 = 1;
        this.au = true;
        if (!this.s()) {
            if (Logger.debug()) {
                Logger.v(TAG, "onPageFinished " + url);
            }

            if (url == null) {
                return;
            }

            if (url.equals("about:blank")) {
                return;
            }

            NewDetailViewHolder v2 = this.mNewDetailViewHolder;
            if (v2 == null) {
                return;
            }

            Article v3 = this.mArticle;
            if (v3 == null) {
                return;
            }

            if (url.startsWith("file:///android_asset/article/")) {
                v2.l = true;
                v1 = true;
            } else {
                if (TTUtils.isValidUrl(url)) {
                    v2.l = true;
                }

                v0 = 0;
            }

            if (this.s > 0 && webView != null && this.mAppData != null) {
                String v4 = SSWebSettings.buildAdJs(this.mAppData.jsActlogUrl, this.s);
                if (!android.support.design.a.isTextEmpty(v4)) {
                    webView.loadUrl(v4);
                }
            }

            this.mAppData.ae();
            this.mArticle.hasArticleUrl();
            v2.mWapStatHelper.onPageFinished(webView, url);
            if ((v1) || v0 != 0) {
                Object v0_1 = this.aJ.get(Long.valueOf(v3.groupId));
                long v4_1 = System.currentTimeMillis();
                if (v0_1 != null && v4_1 - ((ArticleInfo) v0_1).d < 600000) {
                    this.a(v2, ((ArticleInfo) v0_1), v1);
                } else {
                    this.d(v3);
                }
            }
            if (android.support.design.a.isTextEmpty(this.c(url))) {
                return;
            }

            if (this.l == null) {
                return;
            }

            if (!this.l.b().isEmpty()) {
                return;
            }

            this.mWeakHandler.postDelayed(new ag(this), 1000);
        }
    }

    public final void b(Comment arg6) {
        if ((this.isViewValid()) && arg6 != null) {
            NewDetailViewHolder v0 = this.mNewDetailViewHolder;
            if (v0 != null && this.mArticle != null) {
                ArticleInfo v0_1 = v0.mNewDetailPageExtra.mArticleInfo;
                if (v0_1 != null && v0_1.wendaData != null && (v0_1.wendaData.isBanComment)) {
                    this.a(0, com.ss.android.article.browser.R.string.wenda_baned_comment_hint);
                    return;
                }

                if (arg6 == null) {
                    return;
                }

                if (this.mArticle.groupId != arg6.groupId) {
                    return;
                }

                MobClickCombiner.onEvent(this.getContext(), "comment", "click_comment");
                MobClickCombiner.onEvent(this.getContext(), "comment", "repost_menu");
                if (this.aj == null) {
                    return;
                }

                this.aj.b();
                this.aj.a(arg6);
                this.aO = 0;
            }
        }
    }

    public final void shareToQQ(String arg4, JSONObject arg5) {
        this.mArticleShareHelper.position = arg4;
        this.mArticleShareHelper.fillShareParams(arg5);
        this.mArticleShareHelper.share(3, this.mArticle);
    }

    static boolean c(NewAnswerDetailFragment arg0, boolean arg1) {
        arg0.at = arg1;
        return arg1;
    }

    final String c(String arg13) {
        ImpressionListAdapter v0_3;
        String v0_2;
        String v4 = null;
        String v1 = android.support.design.a.isTextEmpty(arg13) ? this.M() : f(arg13);
        if (!android.support.design.a.isTextEmpty(v1)) {
            Article v6 = this.mArticle;
            long v2 = 0;
            if (v6 != null) {
                v2 = v6.groupId;
            }

            String v5 = String.valueOf(v2) + "_" + v1;
            Object v0 = this.aW.get(v5);
            if (v0 == null) {
                q$b v7 = new q$b();
                v7.a = this.aW.size();
                if (v6 != null) {
                    com.ss.android.article.base.utils.JSONObjectWrapper v0_1 = new com.ss.android.article.base.utils.JSONObjectWrapper();
                    v0_1.put("item_id", v6.itemId);
                    v0_1.put("aggr_type", v6.aggrType);
                    v0_2 = v0_1.jsonObject.toString();
                } else {
                    v0_2 = v4;
                }

                ImpressionListAdapter v6_1 = new ImpressionListAdapter(String.valueOf(v2) + "_" + v7.a + "_" + v1, v0_2);
                v7.b = v6_1;
                this.registerLifeCycleMonitor(((LifeCycleMonitor) v6_1));
                this.aW.put(v5, v7);
                v0_3 = v6_1;
            } else {
                v0_3 = ((q$b) v0).b;
            }

            if (v0_3 == null) {
                return v4;
            }

            v0_3.a(this.N());
            this.l = v0_3;
            v4 = v5;
        }

        return v4;
    }

    private static void c(NewDetailViewHolder arg2) {
        if (arg2 != null && arg2.mListView != null && arg2.mNewDetailAdapter != null && !arg2.mDetailScrollView.g) {
            arg2.mNewDetailAdapter.a(arg2.mDetailScrollView.getScrollY());
        }
    }

    private void c(Article arg4) {
        if (arg4 != null) {
            Article v1 = this.mArticle;
            if (v1 != null) {
                switch (this.getCommentMode()) {
                    case 0: {
                        if (!this.s()) {
                            ((NewAnswerDetailActivity) this.getActivity()).b(((AbsArticle) v1).userRepin);
                        }

                        break;
                    }
                }

                int v2 = ((AbsArticle) v1).commentCount;
                boolean v1_1 = ((AbsArticle) v1).mBanComment ? false : true;
                if (this.s()) {
                } else {
                    ((NewAnswerDetailActivity) this.getActivity()).l.setCommentCount(v2);
                    ((NewAnswerDetailActivity) this.getActivity()).a(v1_1);
                }
            }
            if (this.s()) {
                return;
            }

            ((NewAnswerDetailActivity) this.getActivity()).k.setInfoTitle(arg4.title);
        }
    }

    static void c(NewAnswerDetailFragment arg0, NewDetailViewHolder arg1) {
        arg0.e(arg1);
    }

    static boolean c(NewAnswerDetailFragment arg1) {
        arg1.ar = true;
        return true;
    }

    public final TTAndroidObject getTTAndroidObject() {
        return this.aN;
    }

    public final void onSharePlatformClick(int arg3) {
        if (arg3 >= 0) {
            this.mArticleShareHelper.position = "detail_bottom_bar_out";
            this.mArticleShareHelper.share(arg3, this.mArticle);
        }
    }

    public final void deleteComment(Comment arg5) {
        if (arg5 != null && (UpdateItemMgr.getInstance(this.getContext()).checkLoginAndNet(arg5.userId))) {
            UpdateItemMgr.showDeleteConfirmDialog(this.getContext(), new com.ss.android.wenda.answer.detail2.y(this, arg5));
        }
    }

    public final void shareToMoment(String arg4, JSONObject arg5) {
        this.mArticleShareHelper.position = arg4;
        this.mArticleShareHelper.fillShareParams(arg5);
        this.mArticleShareHelper.share(1, this.mArticle);
    }

    public final boolean shouldOverrideUrlLoading(WebView webView, String url) {
        NewDetailViewHolder v0_7;
        int v2_2;
        long v0_6;
        Intent v3_3;
        int v1_2 = 0;
        int v0_4;
        String v0_2;
        Uri v0_1;
        int v11 = com.ss.android.article.browser.R.id.webview_transform_key;
        long v8 = 0;
        boolean v1 = false;
        String v2 = null;
        if (!android.support.design.a.isTextEmpty(url) && !this.s()) {
            if (Logger.debug()) {
                Logger.v(TAG, "check url: " + System.currentTimeMillis() + " " + url);
            }

            v0_1 = Uri.parse(url);
            Uri v3_1 = v0_1;
            v0_2 = v0_1.getScheme();

            if (v3_1 != null && v0_2 != null) {
                if (v0_2.equals("bytedance")) {
                    try {
                        v0_1 = Uri.parse(url);
                    } catch (Exception v0) {
                        v0_1 = ((Uri) null);
                    }

                    if (v0_1 != null) {
                        String v3_2 = v0_1.getHost();
                        Article v10 = this.mArticle;
                        long v4 = this.s;
                        if (("domReady".equals(v3_2)) && this.aB != null) {
                            this.aB.onDomReady(webView);
                            return true;
                        }

                        if ("large_image".equals(v3_2)) {
                            v3_2 = v0_1.getQueryParameter("url");
                            v0_2 = v0_1.getQueryParameter("index");
                            try {
                                v0_4 = Integer.parseInt(v0_2);
                            } catch (NumberFormatException v0_3) {
                                v0_4 = 0;
                            }

                            if (android.support.design.a.isTextEmpty(v3_2)) {
                                return true;
                            }

                            if (this.s()) {
                                return true;
                            }

                            ArrayList v1_1 = new ArrayList();
                            if (this.mArticleDetail != null && this.mArticleDetail.imageDetail != null) {
                                ((List) v1_1).addAll(this.mArticleDetail.imageDetail);
                            }

                            if ((((List) v1_1).isEmpty()) && (TTUtils.isValidUrl(v3_2))) {
                                ((List) v1_1).add(new ImageInfo(v3_2, v2));
                            }

                            if (((List) v1_1).isEmpty()) {
                                return true;
                            }

                            MobClickCombiner.onEvent(this.getContext(), "image", "enter_detail");
                            this.report("image_button");
                            this.startThumbPreviewActivity(((List) v1_1), v0_4);
                            return true;
                        }

                        if ("origin_image".equals(v3_2)) {
                            this.report("enlarger_image");
                            return true;
                        }

                        if ("show_image".equals(v3_2)) {
                            this.report("show_one_image");
                            return true;
                        }

                        if ("contentchanged".equals(v3_2)) {
                            v0_4 = webView.getHeight();
                            v1_2 = webView.getContentHeight();
                            if (!Logger.debug()) {
                                return true;
                            }

                            Logger.d(TAG, "content changed " + url + " " + v0_4 + " " + v1_2);
                            return true;
                        }

                        if ("toggle_image".equals(v3_2)) {
                            v0_4 = this.mAppData.clickShowLargeImageBtn;
                            if (v0_4 == 1) {
                                this.mAppData.setClickShowLargeImageBtn(v0_4 + 1);
                                AlertDialog.Builder v1_3 = com.ss.android.j.b.createDialogBuilder(this.getActivity());
                                v1_3.setTitle(com.ss.android.article.browser.R.string.ss_hint);
                                v1_3.setMessage(com.ss.android.article.browser.R.string.detail_show_large_image_dlg);
                                v1_3.setPositiveButton(this.getString(com.ss.android.article.browser.R.string.ss_confirm), new af(this));
                                v1_3.setNegativeButton(this.getActivity().getString(com.ss.android.article.browser.R.string.ss_cancel), ((DialogInterface.OnClickListener) null));
                                v1_3.show();
                            } else if (v0_4 <= 0) {
                                this.mAppData.setClickShowLargeImageBtn(v0_4 + 1);
                            }

                            this.report("show_image");
                            return true;
                        }

                        if ("finish_content".equals(v3_2)) {
                            this.report("finish_content");
                            if (v10 == null) {
                                return true;
                            }

                            this.a("finish_content", ((BaseArticle) v10), v4);
                            return true;
                        }

                        if ("finish_comment".equals(v3_2)) {
                            if (v10 == null) {
                                return true;
                            }

                            this.a("finish_comment", ((BaseArticle) v10), v4);
                            return true;
                        }

                        if ("read_content".equals(v3_2)) {
                            if (v10 == null) {
                                return true;
                            }

                            this.a("read_content", ((BaseArticle) v10), v4);
                            return true;
                        }

                        if ("user_profile".equals(v3_2)) {
                            try {
                                if (Long.parseLong(v0_1.getQueryParameter("user_id")) <= v8) {
                                    return true;
                                }

                                v0_2 = v0_1.getQueryParameter("action");
                                if ("digg".equals(v0_2)) {
                                    this.report("click_digg_users");
                                } else if ("bury".equals(v0_2)) {
                                    this.report("click_bury_users");
                                } else if ("repin".equals(v0_2)) {
                                    this.report("click_favorite_users");
                                }

                                this.getActivity();
                                AppData.aK();
                            } catch (Exception v0) {
                                Logger.w(TAG, "url user_profile exception: " + url + " " + v0);
                            }

                            return true;
                        }

                        if ("click_source".equals(v3_2)) {
                            this.report("click_source");
                            return true;
                        }

                        if ("keywords".equals(v3_2)) {
                            try {
                                v2 = v0_1.getQueryParameter("keyword");
                                v0_2 = v0_1.getQueryParameter("index");
                                if (android.support.design.a.isTextEmpty(v2)) {
                                    return true;
                                }

                                this.report("click_keyword_" + v0_2);
                                FragmentActivity v0_5 = this.getActivity();
                                v3_3 = new Intent();
                                v3_3.setClassName(((Context) v0_5), "com.ss.android.article.base.feature.search.SearchActivity");
                                v3_3.putExtra("keyword", v2);
                                v3_3.putExtra("from", "content");
                                Article v2_1 = this.mArticle;
                                if (v2_1 != null) {
                                    v8 = ((AbsArticle) v2_1).groupId;
                                    v0_6 = ((AbsArticle) v2_1).itemId;
                                    v2_2 = ((AbsArticle) v2_1).aggrType;
                                } else {
                                    v2_2 = 0;
                                    v0_6 = v8;
                                }
                                v3_3.putExtra("group_id", v8);
                                v3_3.putExtra("item_id", v0_6);
                                v3_3.putExtra("aggr_type", v2_2);
                                this.startActivity(v3_3);
                            } catch (Exception v0) {
                                label_284:
                                Logger.w(TAG, "url search excepton: " + url + " " + v0);
                            }

                            return true;
                        }

                        if ("media_account".equals(v3_2)) {
                            try {
                                Long mediaId = Long.valueOf(Long.parseLong(v0_1.getQueryParameter("media_id")));
                                this.report("click_pgc_profile");
                                String locString = v0_1.getQueryParameter("loc");
                                int loc = 0;
                                if (!android.support.design.a.isTextEmpty(locString)) {
                                    loc = Integer.parseInt(locString);
                                }

                                String enterFrom = loc > 0 ? "article_bottom_author" : "article_top_author";
                                PgcActivity.startActivity(this.mContext, mediaId.longValue(), enterFrom);
                            } catch (Exception exception) {
                                Logger.w(TAG, "url pgc's media_account excepton: " + url + " " + exception);
                            }

                            return true;
                        }

                        if ("open_origin_url".equals(v3_2)) {
                            try {
                                v0_2 = v0_1.getQueryParameter("url");
                                if (!TTUtils.isValidUrl(v0_2)) {
                                    return true;
                                }

                                this.e(webView, v0_2);
                            } catch (Exception v0) {
                                Logger.w(TAG, "open_origin_url exception: " + url + " " + v0);
                            }

                            return true;
                        }

                        if ("article_impression".equals(v3_2)) {
                            try {
                                long v2_4 = android.support.design.a.x(v0_1.getQueryParameter("groupid"));
                                v4 = android.support.design.a.x(v0_1.getQueryParameter("item_id"));
                                int v6 = android.support.design.a.d(v0_1.getQueryParameter("aggr_type"), 0);
                                if (v10 == null) {
                                    return true;
                                }

                                if (v10.groupId <= v8) {
                                    return true;
                                }

                                if (v2_4 <= v8) {
                                    return true;
                                }

                                AppData.a(v10.groupId, v2_4, v4, v6);
                            } catch (Exception v0) {
                            }

                            return true;
                        }

                        if ("transcode_error".equals(v3_2)) {
                            v0_7 = this.mNewDetailViewHolder;
                            if (v0_7 == null) {
                                return true;
                            }

                            if (v10 == null) {
                                return true;
                            }

                            if (v10.delete) {
                                return true;
                            }

                            if (!v10.c()) {
                                return true;
                            }

                            this.a(com.ss.android.article.browser.R.drawable.close_popup_textpage, com.ss.android.article.browser.R.string.detail_transform_failed);
                            v0_7.mWebView.setTag(v11, v2);
                            v0_7.mWebView.setTag(com.ss.android.article.browser.R.id.webview_client_transform_key, v2);
                            v0_7.mWebView.setTag(com.ss.android.article.browser.R.id.webview_support_js, v2);
                            return true;
                        }

                        if (this.aN == null) {
                            return true;
                        }

                        if (!NewArticleDetailTTAndroidObject.canHandleUri(v0_1)) {
                            return true;
                        }

                        try {
                            this.aN.handleUri(v0_1);
                        } catch (Exception v0) {
                            Logger.w(TAG, "TTAndroidObj handleUri exception: " + v0);
                        }

                        return true;
                    } else {
                        return true;
                    }
                } else {
                    if (TTUtils.isValidUrl(url)) {
                        webView.setTag(com.ss.android.article.browser.R.id.webview_client_transform_key, v2);
                        webView.setTag(v11, v2);
                        webView.setTag(com.ss.android.article.browser.R.id.webview_support_js, v2);
                        this.O();
                        this.e(url);
                        v0_7 = this.mNewDetailViewHolder;
                        if (v0_7 == null) {
                            return v1;
                        }

                        v0_7.mWapStatHelper.b(webView, url);
                        return v1;
                    }

                    if (!v0_2.equals("about") && !"about:blank".equals(url)) {
                        try {
                            if ((v0_2.equals("sslocal")) || (v0_2.equals("localsdk"))) {
                                url = AdsAppBaseActivity.b(url);
                            }

                            if (this.mAppData.i(url)) {
                                return true;
                            }

                            if ((this.t) && !com.ss.android.article.base.feature.app.a.c.b(v0_2)) {
                                return true;
                            }

                            AppUtil.b(this.getContext(), url);
                        } catch (Exception v0) {
                        }

                        return true;
                    }

                    webView.setTag(v11, v2);
                    return v1;
                }
            }

            v1 = true;
        } else {
            v1 = true;
        }

        return v1;
    }

    static boolean d(NewAnswerDetailFragment arg0, boolean arg1) {
        arg0.ay = arg1;
        return arg1;
    }

    private void d(Article arg6) {
        Object v4 = null;
        if (arg6 != null) {
            Object v0 = this.aJ.get(Long.valueOf(arg6.groupId));
            long v2 = System.currentTimeMillis();
            int v0_1 = v0 == null || v2 - ((ArticleInfo) v0).d > 600000 ? 1 : 0;
            if (v0_1 == 0) {
                return;
            }

            if (!NetworkUtils.isNetworkAvailable(this.mContext)) {
                return;
            }

            this.aL.f.addTask(arg6.getItemKey(), arg6, v4, v4);
        }
    }

    final boolean d() {
        boolean v0 = true;
        int v1 = this.getCommentMode();
        if (v1 != 1 && v1 != 2) {
            v0 = false;
        }

        return v0;
    }

    private void d(String arg5) {
        JSONObject v1 = new JSONObject();
        try {
            v1.put("item_id", this.mArticle.itemId);
        } catch (JSONException v0) {
            v0.printStackTrace();
        }

        this.reportEvent(arg5, v1);
    }

    static DetailHelper d(NewAnswerDetailFragment arg1) {
        return arg1.aj;
    }

    private void d(NewDetailViewHolder arg7) {
        if (arg7 != null && arg7.mDetailScrollView != null && arg7.mNewDetailPageExtra != null && !arg7.isDetailCommentsShowReported) {
            Article v1 = this.mArticle;
            if (v1 != null) {
                int[] v2 = new int[2];
                arg7.mDetailScrollView.getLocationInWindow(v2);
                int v3 = arg7.mDetailScrollView.getHeight() + v2[1];
                int v0 = 2147483647;
                v2[1] = v0;
                if (arg7.mNewDetailPageExtra.mContentsWrapper != null && (arg7.mNewDetailPageExtra.mContentsWrapper.isShown())) {
                    arg7.mNewDetailPageExtra.mContentsWrapper.getLocationInWindow(v2);
                    v0 = v2[1] + arg7.mNewDetailPageExtra.mContentsWrapper.getHeight();
                }

                if (v0 >= v3) {
                    return;
                }

                arg7.isDetailCommentsShowReported = true;
                this.a("enter_comment", ((BaseArticle) v1), this.s);
                if (!this.mAppData.loginCommentFirst) {
                    this.a(this.mContext, 1);
                }

                this.aQ = true;
            }
        }
    }

    static void d(NewAnswerDetailFragment arg0, NewDetailViewHolder arg1) {
        arg0.d(arg1);
    }

    private void reportEvent(String arg10, JSONObject arg11) {
        MobClickCombiner.onEvent(this.mContext, "detail", arg10, this.mArticle.groupId, this.s, arg11);
    }

    public final void doUpdateVisitedHistory(WebView webView, String url) {
        if (!this.s() && webView != null) {
            NewDetailViewHolder v0 = this.mNewDetailViewHolder;
            if (v0 != null && this.mArticle != null && this.s > 0) {
                v0.mWapStatHelper.c(webView, url);
            }
        }
    }

    static boolean e(NewAnswerDetailFragment arg1) {
        return arg1.s();
    }

    static void e(NewAnswerDetailFragment arg12, boolean arg13) {
        NewDetailViewHolder v3 = arg12.mNewDetailViewHolder;
        if (v3 != null) {
            ArticleInfo v0 = v3.mNewDetailPageExtra.mArticleInfo;
            Article v4 = v3.mNewDetailPageExtra.mArticle;
            if (v4 != null && v0 != null) {
                if (arg13) {
                    v0.increaseUserLikeNum();
                    ++v4.likeCount;
                    v4.userLike = arg13;
                    v0.setUserLike(arg13);
                    long v6 = arg12.s;
                    AbsArticle.a v5 = new AbsArticle.a();
                    int v0_1 = v4.userLike ? 1 : 0;
                    v5.userLike = v0_1;
                    v5.likeCount = v4.likeCount;
                    CallbackCenter.notifyCallback(BaseAppData.callbackTypeSpipeItemStateChanged, new Object[]{BaseAppData.callbackTypeSpipeItemStateChanged, Long.valueOf(v4.groupId), v5});
                    if (v4 != null) {
                        v0_1 = arg13 ? 18 : 19;
                        arg12.mArticleActionHelper.a(v0_1, ((AbsArticle) v4), v6);
                    }

                    v3.mNewDetailPageExtra.a();
                } else {
                    arg12.a(0, com.ss.android.article.browser.R.string.ss_hint_digg);
                }
            }
        }
    }

    private void e(Article arg3) {
        if (arg3 != null) {
            arg3.clickTimestamp = System.currentTimeMillis();
            DBHelper v0 = DBHelper.getInstance(this.mContext);
            if (v0 != null) {
                v0.syncReadTs(((AbsArticle) arg3));
            }
        }
    }

    private void e(String arg7) {
        Object v0;
        String v1 = f(arg7);
        if (v1 != null) {
            String v2 = this.c(v1);
            if (!android.support.design.a.isTextEmpty(v2) && !this.aW.isEmpty()) {
                Iterator v3 = this.aW.entrySet().iterator();
                while (v3.hasNext()) {
                    v0 = v3.next();
                    if (!v2.equals(((Map.Entry) v0).getKey())) {
                        continue;
                    }

                    v0 = ((Map.Entry) v0).getValue();
                    if (v0 == null) {
                        continue;
                    }

                    if (((q$b) v0).a < 0) {
                        continue;
                    }

                    ImpressionListAdapter v0_1 = ((q$b) v0).b;
                    if (v0_1 == null) {
                        continue;
                    }

                    v0_1.onPause();
                }
            }

            if (this.l != null) {
                this.l.onResume();
            }

            v0 = this.aX.get(v1);
            if (v0 != null) {
                ((q$a) v0).maxscrollheight = 0;
                return;
            }

            q$a v0_2 = new q$a((byte) 0);
            v0_2.url = v1;
            v0_2.e = this.aX.size();
            this.aX.put(v1, v0_2);
        }
    }

    private void e(NewDetailViewHolder arg6) {
        if (arg6 != null && !arg6.isDetailAdShowReported && arg6.mNewDetailPageExtra != null && arg6.mNewDetailPageExtra.mDetailAdContainer != null && arg6.mNewDetailPageExtra.mDetailAdContainer.getVisibility() == View.VISIBLE && arg6.mNewDetailPageExtra.mArticleInfo != null && (arg6.mNewDetailPageExtra.b())) {
            int[] v0 = new int[2];
            arg6.mDetailScrollView.getLocationOnScreen(v0);
            int v1 = v0[1] + arg6.mDetailScrollView.getHeight();
            arg6.mNewDetailPageExtra.mDetailAdContainer.getLocationOnScreen(v0);
            if (v0[1] >= 0 && v0[1] <= v1) {
                this.a(arg6.mNewDetailPageExtra.mArticleInfo.mBannerAdsData);
                this.a(arg6.mNewDetailPageExtra.mArticleInfo.A);
                this.a(arg6.mNewDetailPageExtra.mArticleInfo.B);
                DownloadAppAd v0_1 = arg6.mNewDetailPageExtra.mArticleInfo.mDownloadAppAd;
                if (v0_1 != null && (((AppAd) v0_1).isValid()) && !ToolUtils.isAppInstalled(this.mContext, ((AppAd) v0_1).pkg)) {
                    BaseAdsData.trackAdShow(this.mContext, "detail_ad", ((BaseAdsData) v0_1), 0);
                }

                this.a(arg6.mNewDetailPageExtra.mArticleInfo.y);
                arg6.isDetailAdShowReported = true;
            }
        }
    }

    private void e(WebView arg7, String arg8) {
        String v1_1;
        String v0_2;
        int v1;
        int v0 = 0;
        try {
            if (Logger.debug()) {
                Logger.d(TAG, arg7.getUrl() + " " + arg8);
            }

            int[] v2 = this.mAppData.w;
            if (v2 != null && v2.length > 0) {
                int v3 = v2.length;
                v1 = 0;
                while (true) {
                    if (v1 < v3) {
                        com.ss.android.newmedia.b.a v4 = android.support.design.a.d(v2[v1]);
                        if (v4 != null && (v4.a(this.mContext, arg8))) {
                            this.report(v4.a());
                            v0 = 1;
                            break;
                        }
                        ++v1;
                        continue;
                    }

                    break;
                }
            }
            if (v0 != 0) {
                return;
            }

            this.report("open_src_url");
            v0_2 = arg7.getUrl();
            if (!TTUtils.isValidUrl(v0_2)) {
                v1_1 = null;
            } else {
                v1_1 = v0_2;
            }
            android.support.design.a.b(this.getActivity(), arg8, v1_1);
        } catch (Exception v0_1) {
            label_44:
            v0_1.printStackTrace();
        }
    }

    static void e(NewAnswerDetailFragment arg0, NewDetailViewHolder arg1) {
        arg0.h(arg1);
    }

    static NewAnswerDetailActivity f(NewAnswerDetailFragment arg1) {
        return (NewAnswerDetailActivity) arg1.getActivity();
    }

    private static String f(String arg4) {
        if (android.support.design.a.isTextEmpty(arg4)) {
            arg4 = null;
        } else {
            int v0 = arg4.indexOf(35);
            if (v0 > 0) {
                int v1 = arg4.indexOf("tt_font=", v0);
                if (v1 == v0 + 1) {
                    arg4 = arg4.substring(0, v0);
                } else if (v1 > v0) {
                    v1 = arg4.indexOf("&tt_font=", v0);
                    if (v1 > v0) {
                        arg4 = arg4.substring(0, v1);
                    }
                }
            }

            if (!arg4.startsWith("file:///android_asset/article/")) {
                return arg4;
            }

            v0 = arg4.indexOf("&token=");
            if (v0 <= 0) {
                return arg4;
            }

            arg4 = arg4.substring(0, v0);
        }

        return arg4;
    }

    private void f(Article arg3) {
        if (this.mNewDetailViewHolder != null) {
            DetailScrollView v1 = this.mNewDetailViewHolder.mDetailScrollView;
            boolean v0 = arg3 == null || !arg3.disableScrollOver() ? false : true;
            v1.setDisableScrollOver(v0);
        }
    }

    private void f(NewDetailViewHolder arg5) {
        if (arg5 != null && !arg5.isConcernWordsShowReported && arg5.mNewDetailPageExtra != null && arg5.mNewDetailPageExtra.mTagLayout != null && arg5.mNewDetailPageExtra.mArticleInfo != null) {
            int[] v0 = new int[2];
            arg5.mDetailScrollView.getLocationOnScreen(v0);
            int v1 = v0[1] + arg5.mDetailScrollView.getHeight();
            arg5.mNewDetailPageExtra.mTagLayout.getLocationOnScreen(v0);
            if (v0[1] >= 0 && v0[1] < v1) {
                arg5.isConcernWordsShowReported = true;
                this.d("concern_words_show");
            }
        }
    }

    public final AbsArticle getArticle() {
        return this.mArticle;
    }

    static boolean g(NewAnswerDetailFragment arg1) {
        return arg1.au;
    }

    private void checkAndReportLikeAndRewardsShow(NewDetailViewHolder newDetailViewHolder) {
        if (newDetailViewHolder != null
                && !newDetailViewHolder.isLikeAndRewardsShowReported
                && newDetailViewHolder.mNewDetailPageExtra != null
                && newDetailViewHolder.mNewDetailPageExtra.mLikeAndRewardsLayout != null
                && newDetailViewHolder.mNewDetailPageExtra.mArticleInfo != null) {
            int[] v0 = new int[2];
            newDetailViewHolder.mDetailScrollView.getLocationOnScreen(v0);
            int v1 = v0[1] + newDetailViewHolder.mDetailScrollView.getHeight();
            newDetailViewHolder.mNewDetailPageExtra.mLikeAndRewardsLayout.getLocationOnScreen(v0);
            if (v0[1] < 0) {
                return;
            }

            if (v0[1] >= v1) {
                return;
            }

            newDetailViewHolder.isLikeAndRewardsShowReported = true;
            JSONObject jsonObject = new JSONObject();
            try {
                jsonObject.put("item_id", this.mArticle.itemId);
                jsonObject.put("has_rewards", 0);
            } catch (JSONException jsonException) {
                jsonException.printStackTrace();
            }

            this.reportEvent("like_and_rewards_show", jsonObject);
        }
    }

    public final long getArticleId() {
        return this.s;
    }

    static long h(NewAnswerDetailFragment arg2) {
        return arg2.av;
    }

    public final int getCommentMode() {
        Article v0 = this.mArticle;
        int v0_1 = v0 == null ? 0 : v0.getCommentMode();
        return v0_1;
    }

    private void h(NewDetailViewHolder arg12) {
        long v4;
        long v8 = -1;
        if (arg12 != null && !arg12.u && arg12.mNewDetailPageExtra != null && arg12.mNewDetailPageExtra.mArticleInfo != null && arg12.mNewDetailPageExtra.d != null) {
            int[] v0 = new int[2];
            arg12.mDetailScrollView.getLocationOnScreen(v0);
            int v1 = v0[1] + arg12.mDetailScrollView.getHeight();
            if (arg12.mNewDetailPageExtra.d == null) {
                return;
            }

            arg12.mNewDetailPageExtra.d.getLocationOnScreen(v0);
            if (v0[1] < 0) {
                return;
            }

            if (v0[1] >= v1) {
                return;
            }

            arg12.u = true;
            MobClickCombiner.onEvent(this.mContext, "detail", "related_article_show", this.c, 0);
            List v0_1 = arg12.mNewDetailPageExtra.mArticleInfo.Z;
            if (v0_1 == null) {
                return;
            }

            try {
                Iterator v10 = v0_1.iterator();
                while (true) {
                    if (!v10.hasNext()) {
                        return;
                    }

                    Object v0_3 = v10.next();
                    if (v0_3 == null) {
                        continue;
                    }

                    if (android.support.design.a.isTextEmpty(((ArticleInfo.RelatedNewsItem) v0_3).e)) {
                        continue;
                    }

                    Uri v0_4 = Uri.parse(AdsAppBaseActivity.b(((ArticleInfo.RelatedNewsItem) v0_3).e));
                    String v1_1 = v0_4.getHost();
                    if ("forum".equals(v1_1)) {
                        v1_1 = v0_4.getQueryParameter("fid");
                        v4 = android.support.design.a.isTextEmpty(v1_1) ? v8 : Long.valueOf(v1_1).longValue();
                        if (v4 == v8) {
                            v4 = Long.valueOf(v0_4.getQueryParameter("id")).longValue();
                        }

                        MobClickCombiner.onEvent(this.mContext, "forum_detail", "show_related", v4, this.c);
                        continue;
                    }

                    if (!"concern".equals(v1_1)) {
                        continue;
                    }

                    String v0_5 = v0_4.getQueryParameter("cid");
                    v4 = android.support.design.a.isTextEmpty(v0_5) ? v8 : Long.valueOf(v0_5).longValue();
                    MobClickCombiner.onEvent(this.mContext, "concern_page", "show_related", v4, this.c);
                }
            } catch (Exception v0_2) {
            }
        }
    }

    public final void onBack() {
        Object v0 = null;
        this.O();
        if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mWebView != null && (this.mNewDetailViewHolder.mWebView.canGoBack())) {
            String url = this.mNewDetailViewHolder.mWebView.getUrl();
            if (url != null && (url.startsWith("file:///android_asset/article/"))) {
                this.a();
                return;
            }

            if ((this.aP) && !this.mNewDetailViewHolder.mWebView.canGoBackOrForward(-2)) {
                WebBackForwardList v0_1 = this.mNewDetailViewHolder.mWebView.copyBackForwardList();
                if (v0_1 != null && v0_1.getCurrentIndex() == 1 && ("about:blank".equals(v0_1.getItemAtIndex(0).getUrl()))) {
                    this.a();
                    return;
                }

                this.a(this.mNewDetailViewHolder, this.mArticle, this.s);
            } else {
                this.mNewDetailViewHolder.mWebView.goBack();
                this.mNewDetailViewHolder.mWebView.setTag(com.ss.android.article.browser.R.id.webview_transform_key, v0);
                this.v();
            }

            this.mNewDetailViewHolder.mDetailScrollView.handOpenDrawer();
            String v0_2 = this.aa ? "page_back_button" : "page_back_key";
            this.report(v0_2);
            this.aa = false;
        } else {
            this.a();
        }
    }

    public void handleMsg(Message message) {
        if (!this.isViewValid()) {
            return;
        }

        if (this.aj != null && (this.aj.handleMsg(message))) {
            return;
        }

        AppData.isNightMode();
        boolean v1 = false;
        switch (message.what) {
            case 14: {
                this.q();
                return;
            }
            case 1003: {
                v1 = true;
                if (!(message.obj instanceof CommentFetcher)) {
                    return;
                }

                this.onCommentLoaded((CommentFetcher) message.obj, v1);
                return;
            }
            case 1004: {
                if (!(message.obj instanceof CommentFetcher)) {
                    return;
                }

                this.onCommentLoaded((CommentFetcher) message.obj, v1);
                return;
            }
            case 10001: {
                this.a(com.ss.android.article.browser.R.drawable.doneicon_popup_textpage, com.ss.android.article.browser.R.string.toast_report_ok);
                return;
            }
            case 10002: {
                this.a(com.ss.android.article.browser.R.drawable.close_popup_textpage, com.ss.android.article.browser.R.string.toast_report_fail);
                return;
            }
            case 10011: {
                if (this.isActive()) {
                    return;
                }

                if (this.mNewDetailViewHolder == null) {
                    return;
                }

                try {
                    this.mNewDetailViewHolder.mWebView.getSettings().setBlockNetworkLoads(true);
                } catch (Exception v0) {
                }

                return;
            }
        }

        return;


    }

    static boolean i(NewAnswerDetailFragment arg1) {
        arg1.au = true;
        return true;
    }

    public final int i() {
        int v0_1;
        int v2 = 0;
        Object v1 = null;
        Iterator v3 = this.aX.values().iterator();
        while (v3.hasNext()) {
            Object v0 = v3.next();
            if (((q$a) v0).e != 0) {
                v0 = v1;
            }

            v1 = v0;
        }

        if (v1 == null || ((q$a) v1).url == null || this.mArticle == null) {
            v0_1 = 0;
            v2 = v0_1;
        } else {
            if (!((q$a) v1).url.startsWith("file:///android_asset/article/") && !((q$a) v1).url.equals(this.mArticle.articleUrl)) {
                return 0;
            }

            v0_1 = this.m();
            int v1_1 = this.H();
            if (v1_1 == 0) {
                return v2;
            }

            q$a v3_1 = this.L();
            if (v3_1 == null) {
                return v2;
            }

            return Math.round(Math.max(v3_1.precentage, (((float) (v0_1 + v3_1.maxscrollheight))) / (((float) v1_1))) * 100f);
        }

        return v2;
    }

    static Runnable j(NewAnswerDetailFragment arg1) {
        return arg1.aT;
    }

    public final long j() {
        long v0 = this.o < 0 ? -1 : System.currentTimeMillis() - this.o;
        return v0;
    }

    static WeakHandler k(NewAnswerDetailFragment arg1) {
        return arg1.mWeakHandler;
    }

    public final int k() {
        return 0;
    }

    static JSONObject l(NewAnswerDetailFragment arg1) {
        return arg1.J();
    }

    public final void disableOverlaySwipe() {
        if (this.E != null) {
            this.E.setSwipeEnabled(false);
        }
    }

    static String m(NewAnswerDetailFragment arg1) {
        return arg1.t();
    }

    final int m() {
        int v0 = this.E == null ? 0 : this.E.getHeight();
        return v0;
    }

    protected final void n() {
        if (this.mArticle != null) {
            Article v0 = this.mArticle;
            if (this.aj != null) {
                this.aj.a(((AbsArticle) v0), this.s);
            }
        }
    }

    static boolean n(NewAnswerDetailFragment arg1) {
        arg1.ac = true;
        return true;
    }

    public final void o() {
        int v2;
        int v6 = com.ss.android.article.browser.R.drawable.doneicon_popup_textpage;
        Article v3 = this.mArticle;
        if (v3 != null) {
            long v4 = this.s;
            boolean v0 = !v3.userRepin ? true : false;
            v3.userRepin = v0;
            this.c(v3);
            AppData.isNightMode();
            if (v3.userRepin) {
                this.a(v6, com.ss.android.article.browser.R.string.toast_favor);
                ++v3.repinCount;
                v2 = 4;
                ArticleHelper.a = true;
            } else {
                this.a(v6, com.ss.android.article.browser.R.string.toast_unfavor);
                --v3.repinCount;
                if (v3.repinCount < 0) {
                    v3.repinCount = 0;
                }

                ArticleHelper.a = false;
                v2 = 5;
            }

            this.mAppData.a = System.currentTimeMillis();
            List v6_1 = this.mSpipe.b();
            if (v3.userRepin) {
                if ((this.mAppData.mShareWhenFavor) && !v6_1.isEmpty()) {
                    this.mArticleActionHelper.a(v2, ((AbsArticle) v3), v4, v6_1);
                    return;
                }

                this.mArticleActionHelper.a(v2, ((AbsArticle) v3), v4);
                return;
            }

            this.mArticleActionHelper.a(v2, ((AbsArticle) v3), v4);
        }
    }

    static q$a o(NewAnswerDetailFragment arg1) {
        return arg1.L();
    }

    public void onActivityResult(int arg3, int arg4, Intent arg5) {
        if (com.ss.android.account.o.isRepeatBindError(arg3, arg4, arg5)) {
            this.Y = true;
        } else if (arg3 == 1003) {
            this.aj.c();
        } else if (!QZone.onShareToQQResult(arg3, arg4, arg5, this.aC) && !QZone.onShareToQQResult(arg3, arg4, arg5, this.aC, true)) {
            if (this.aG != null) {
                this.aG.onActivityResult(arg3, arg4, arg5);
            }

            super.onActivityResult(arg3, arg4, arg5);
        }
    }

    @Nullable
    public View onCreateView(LayoutInflater arg3, @Nullable ViewGroup arg4, @Nullable Bundle arg5) {
        SubscriptionRouter.addSubscriber(this);
        View v0 = arg3.inflate(com.ss.android.article.browser.R.layout.ak, arg4, false);
        this.g = ((ViewGroup) v0);
        return v0;
    }

    public void onDestroy() {
        com.ss.android.article.base.ui.ScrollListenerWebView v6 = null;
        super.onDestroy();
        Iterator<Map.Entry> v1 = this.aW.entrySet().iterator();
        while (v1.hasNext()) {
            Object v0 = v1.next().getValue();
            if (v0 == null) {
                continue;
            }

            if (((q$b) v0).a < 0) {
                continue;
            }

            ImpressionListAdapter v0_1 = ((q$b) v0).b;
            if (v0_1 == null) {
                continue;
            }

            com.ss.android.action.b.b v2 = v0_1.b;
            if (v2 == null) {
                continue;
            }

            ImpressionHelper.getInstance().a(v2, v0_1.a);
        }

        CallbackCenter.removeCallback(BaseAppData.callbackTypeAddArticleCommentFromUpdate, this.aD);
        this.mAppData.b(this.mArticle);
        NewDetailViewHolder v1_1 = this.mNewDetailViewHolder;
        if (v1_1 != null) {
            if (v1_1.mNewDetailAdapter != null) {
                v1_1.mNewDetailAdapter.onDestroy();
            }

            if (this.mArticle != null) {
                v1_1.mWapStatHelper.reportJumpCount(this.getActivity(), this.s, this.b);
                v1_1.mWapStatHelper.reportJumpLinks(this.getActivity(), this.s, this.b);
            }

            if (v1_1.mWebView != null) {
                v1_1.mWebView.loadUrl("about:blank");
                v1_1.mWebView.stopLoading();
            }

            WebViewTweaker.clearWebviewOnDestroy(v1_1.mWebView);
            if (v1_1.mDetailScrollView != null) {
                v1_1.mDetailScrollView.removeAllViews();
            }

            v1_1.mWebView = v6;
        }

        if (this.aL != null) {
            com.ss.android.wenda.answer.detail2.a v0_2 = this.aL;
            if (v0_2.d != null) {
                v0_2.d.stop();
            }

            if (v0_2.c != null) {
                v0_2.c.stop();
            }

            if (v0_2.e != null) {
                v0_2.e.stop();
            }

            if (v0_2.f == null) {
            } else {
                v0_2.f.stop();
            }
        }

        ImageProvider.remoteOnRemoteImageLoadedListener(((ImageProvider.OnRemoteImageLoadedListener) this));
        if (this.aN != null) {
            this.aN.b();
        }

        if (this.aQ) {
            this.mAppData.loginCommentFirst = false;
        }

        this.mWeakHandler.removeCallbacksAndMessages(v6);
        ActivityStackManager.removeActivity(Type.WENDA_ACTIVITY, this.getActivity());
    }

    public void onDestroyView() {
        super.onDestroyView();
        SubscriptionRouter.removeSubscriber(this);
    }

    public void onPause() {
        long v8 = 0;
        if (this.mNewDetailViewHolder.mWebView != null) {
            LoadUrlUtils.loadUrl(this.mNewDetailViewHolder.mWebView, "javascript:on_page_disappear()");
        }

        this.O();
        NewDetailViewHolder v0 = this.mNewDetailViewHolder;
        Article v1 = this.mArticle;
        this.b(v1);
        if (this.n) {
            if (v0 != null && v1 != null && (v0.m) && this.p != null && v1.groupId == this.p.groupId) {
                this.w();
            }

            this.o = v8;
            this.p = null;
            this.q = v8;
            this.b(v1);
            if (this.an == null) {
            } else {
                this.an.put("read_pct", String.valueOf(this.i()));
                this.an.put("page_count", String.valueOf(this.N()));
                this.setLeaveContext(this.an);
                this.an.clear();
            }
        }

        this.mAppData.d(false);
        if (v0 != null) {
            v0.mNewDetailAdapter.onPause();
            if (v0.mNewDetailPageExtra != null) {
                v0.mNewDetailPageExtra.e();
            }

            WebViewPauseResumeCompat.onPause(v0.mWebView);
            WebViewTweaker.tweakPauseIfFinishing(this.mContext, v0.mWebView);
            if (this.s()) {
                v0.mWebView.getSettings().setJavaScriptEnabled(false);
            } else {
                this.mWeakHandler.sendEmptyMessageDelayed(10011, 120000);
            }
        }

        super.onPause();
        if (this.aN != null) {
            NewArticleDetailTTAndroidObject.e();
        }
    }

    @Subscriber
    public void onPayCallback(com.ss.android.article.base.feature.detail2.event.a arg5) {
        if (arg5.a == 0 && (this.mSpipe.isLogin)) {
            UserInfo v0 = new UserInfo(this.mSpipe.userId);
            v0.avatarUrl = this.mSpipe.avatarUrl;
            v0.userVerified = this.mSpipe.userVerified;
            this.mNewDetailViewHolder.mNewDetailPageExtra.a(v0);
        }
    }

    public void onResume() {
        int v14 = com.ss.android.article.browser.R.color.ssxinmian4;
        String v3 = null;
        long v6 = 0;
        super.onResume();
        NewDetailViewHolder v9 = this.mNewDetailViewHolder;
        if (v9 != null) {
            this.mWeakHandler.removeMessages(10011);
            v9.mWebView.getSettings().setBlockNetworkLoads(false);
            if (!this.L && v9.mNewDetailPageExtra != null) {
                v9.mNewDetailPageExtra.c();
            }
        }

        if (this.L) {
            this.L = false;
            if (this.W) {
                JSONObject jsonObject = new JSONObject();
                try {
                    jsonObject.put("item_id", this.u);
                    jsonObject.put("aggr_type", this.v);
                } catch (Exception v0) {
                }

                this.getContext();
                AppLog.onEvent("apn", "notice", v3, this.c, v6, jsonObject);
            }

            if (this.mNewDetailViewHolder == null) {
            } else if (this.mArticle != null && (this.mArticle.delete)) {
                if (!this.s()) {
                    ((NewAnswerDetailActivity) this.getActivity()).b(this.mArticle);
                } else {
                }
            } else {
                mNewDetailViewHolder.mDetailScrollView.setMyOnChangedListener(new DetailScrollView.MyOnChangedListener() {

                    public final void a() {
                        NewAnswerDetailFragment.b(mNewDetailViewHolder);
                    }

                    public final void onScrollChanged(int l) {
                        int v1 = 340;
                        if (!NewAnswerDetailFragment.b(NewAnswerDetailFragment.this)) {
                            if (l >= v1 && !NewAnswerDetailFragment.w(NewAnswerDetailFragment.this)) {
                                NewAnswerDetailFragment.a(NewAnswerDetailFragment.this, true);
                            } else if (l >= v1) {
                            } else if (!NewAnswerDetailFragment.w(NewAnswerDetailFragment.this)) {
                            } else {
                                NewAnswerDetailFragment.a(NewAnswerDetailFragment.this, false);
                            }
                        }

                        if (NewAnswerDetailFragment.x(NewAnswerDetailFragment.this) != null
                                && NewAnswerDetailFragment.y(NewAnswerDetailFragment.this) > 0) {
                            if (l >= NewAnswerDetailFragment.a(NewAnswerDetailFragment.this).mWebView.getHeight() - NewAnswerDetailFragment.y(NewAnswerDetailFragment.this)
                                    && !NewAnswerDetailFragment.z(NewAnswerDetailFragment.this)
                                    && NewAnswerDetailFragment.A(NewAnswerDetailFragment.this) != null) {
                                NewAnswerDetailFragment.d(NewAnswerDetailFragment.this, true);
                                AnimatorUtil.animateTopSlideIn(NewAnswerDetailFragment.x(NewAnswerDetailFragment.this));
                            } else if (l >= NewAnswerDetailFragment.a(NewAnswerDetailFragment.this).mWebView.getHeight() - NewAnswerDetailFragment.y(NewAnswerDetailFragment.this)) {
                            } else if (!NewAnswerDetailFragment.z(NewAnswerDetailFragment.this)) {
                            } else {
                                NewAnswerDetailFragment.d(NewAnswerDetailFragment.this, false);
                                AnimatorUtil.animateTopSlideOut(NewAnswerDetailFragment.x(NewAnswerDetailFragment.this));
                            }
                        }

                        if (!NewAnswerDetailFragment.u(NewAnswerDetailFragment.this)
                                && l >= NewAnswerDetailFragment.this.g.getHeight()) {
                            NewAnswerDetailFragment.c(NewAnswerDetailFragment.this, true);
                        }

                        NewAnswerDetailFragment.this.a(mNewDetailViewHolder);
                    }

                    public final void setInfoTitleBarVisibility(boolean arg3) {
                        Article v0 = NewAnswerDetailFragment.this.mArticle;
                        if (v0 != null && !NewAnswerDetailFragment.e(NewAnswerDetailFragment.this)) {
                            NewAnswerDetailActivity v1 = NewAnswerDetailFragment.f(NewAnswerDetailFragment.this);
                            boolean v0_1 = !v0.disableScrollOver() || !arg3 ? false : true;
                            v1.k.setInfoTitleBarVisibility(v0_1);
                        }
                    }
                } );
                if ((mNewDetailViewHolder.mWebView.canGoBack()) || (mNewDetailViewHolder.mWebView.canGoForward())) {
                    mNewDetailViewHolder.mWebView.clearHistory();
                }

                mNewDetailViewHolder.mWebView.setTag(com.ss.android.article.browser.R.id.webview_history_key, v3);
                mNewDetailViewHolder.isDetailCommentsShowReported = false;
                mNewDetailViewHolder.isDetailAdShowReported = false;
                mNewDetailViewHolder.isFinishCommentReported = false;
                mNewDetailViewHolder.l = false;
                mNewDetailViewHolder.m = false;
                mNewDetailViewHolder.everEnterComment = false;
                mNewDetailViewHolder.mNewDetailAdapter.addAllComment(((List) null));
                mNewDetailViewHolder.mNewDetailAdapter.notifyDataSetChanged();
                long v4 = this.s;
                long v0_1 = this.c;
                mNewDetailViewHolder.mNewDetailPageExtra.setArticle(this.mArticle);
                if (this.mArticle != null) {
                    v0_1 = this.mArticle.groupId;
                }

                if (v0_1 > v6) {
                    mNewDetailViewHolder.mNewDetailAdapter.e = String.valueOf(v0_1);
                }

                mNewDetailViewHolder.mDetailScrollView.scrollTo(0, 0);
                if (this.mArticle != null && this.mArticle.groupId == this.S && this.S > v6 && !this.U) {
                    this.U = true;
                    mNewDetailViewHolder.everEnterComment = true;
                    mNewDetailViewHolder.mDetailScrollView.setShowBottomViewOnFirstLayout(true);
                }

                this.a(mNewDetailViewHolder, this.mArticle, v4);
                this.a(mNewDetailViewHolder, AppData.isNightMode());
                this.f(this.mArticle);
                this.G();
                this.I();
            }
        }
        if (this.isActive()) {
            boolean v1 = AppData.isNightMode();
            if (v1 != this.D) {
                this.mNewDetailViewHolder.mNewDetailPageExtra.d();
                if (this.mNoNetView != null) {
                    this.mNoNetView.initNoDataActionBtn();
                }

                this.D = v1;
                this.aj.notifyViewAdaptNightMode();
                this.g.setBackgroundColor(this.F.getColor(v14));
                String v0_2 = v1 ? "javascript: TouTiao.setDayMode(0)" : "javascript: TouTiao.setDayMode(1)";
                if (mNewDetailViewHolder != null) {
                    Article v4_1 = this.mArticle;
                    if (!mNewDetailViewHolder.hasArticleUrl(v4_1) || v4_1 != null && (v4_1.d())) {
                        this.mNewDetailViewHolder.mWebView.setBackgroundColor(this.F.getColor(v14));
                        LoadUrlUtils.loadUrl(mNewDetailViewHolder.mWebView, v0_2);
                        Logger.d(TAG, v0_2);
                    }

                    this.a(mNewDetailViewHolder, v1);
                    this.I();
                    mNewDetailViewHolder.mNewDetailAdapter.notifyDataSetChanged();
                }

                if (this.aw == null) {
                } else {
                    NextAnswerView v0_3 = this.aw;
                    Resources v1_1 = v0_3.getResources();
                    v0_3.a.setTextColor(v1_1.getColorStateList(com.ss.android.article.browser.R.color.novel_catalog_text_color));
                    v0_3.b.setTextColor(v1_1.getColorStateList(com.ss.android.article.browser.R.color.novel_catalog_text_color));
                    v0_3.c.setBackgroundColor(v1_1.getColor(com.ss.android.article.browser.R.color.ssxinxian1));
                    v0_3.setBackgroundColor(v1_1.getColor(v14));
                }
            }
        }

        this.aI = this.mAppData.mFontSizePref;
        if (this.aL != null) {
            com.ss.android.wenda.answer.detail2.a v0_4 = this.aL;
            if (v0_4.d != null) {
                v0_4.d.resume();
            }

            if (v0_4.c != null) {
                v0_4.c.resume();
            }

            if (v0_4.e != null) {
                v0_4.e.resume();
            }

            if (v0_4.f == null) {
            } else {
                v0_4.f.resume();
            }
        }

        if (v9 != null) {
            v9.mNewDetailAdapter.onResume();
            WebViewPauseResumeCompat.onResume(v9.mWebView);
        }

        Article v0_5 = this.mArticle;
        long v10 = this.s;
        if (this.n) {
            if (v0_5 != null && v9 != null && (v9.m)) {
                this.o = System.currentTimeMillis();
                this.p = new BaseArticle(v0_5.groupId, v0_5.itemId, v0_5.aggrType);
                this.q = v10;
            } else {
                this.o = v6;
                this.p = ((BaseArticle) null);
                this.q = v6;
            }
        } else {
            this.n = true;
        }

        if (v0_5 != null) {
            this.c(v0_5);
        }

        if (this.Y) {
            Spipe.loginDupAlert(this.getActivity());
        } else {
            SplashAdActivity.a(this.getContext(), this.Z);
            this.Z = false;
        }

        this.Y = false;
        if (this.aN != null) {
            this.aN.onResume();
        }
    }

    public void onStop() {
        super.onStop();
        if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mNewDetailAdapter != null) {
            this.mNewDetailViewHolder.mNewDetailAdapter.onStop();
        }

        if (this.aL != null) {
            com.ss.android.wenda.answer.detail2.a v0 = this.aL;
            if (v0.d != null) {
                v0.d.pause();
            }

            if (v0.c != null) {
                v0.c.pause();
            }

            if (v0.e != null) {
                v0.e.pause();
            }

            if (v0.f == null) {
            } else {
                v0.f.pause();
            }
        }

        if (this.mNoNetView != null) {
            this.mNoNetView.b();
        }
    }

    @Subscriber
    public void onThumbPreviewStatusChanged(ThumbPreviewStatusEvent arg11) {
        NewDetailViewHolder v0;
        long v6 = 0;
        if (arg11 != null && !this.n) {
            if (arg11.a == 0) {
                v0 = this.mNewDetailViewHolder;
                Article v6_1 = this.mArticle;
                long v8 = this.s;
                if (v6_1 != null && v0 != null && (v0.m)) {
                    this.o = System.currentTimeMillis();
                    this.p = new BaseArticle(v6_1.groupId, v6_1.itemId, v6_1.aggrType);
                    this.q = v8;
                }
            } else if (arg11.a == 1) {
                v0 = this.mNewDetailViewHolder;
                Article v1 = this.mArticle;
                if (v0 != null && v1 != null && (v0.m) && this.p != null && v1.groupId == this.p.groupId) {
                    this.w();
                }

                this.o = v6;
                this.p = null;
                this.q = v6;
                this.b(v1);
                if (this.an == null) {
                    return;
                }

                this.an.put("read_pct", String.valueOf(this.i()));
                this.an.put("page_count", String.valueOf(this.N()));
                this.setLeaveContext(this.an);
                this.an.clear();
            }
        }
    }

    public void onViewCreated(View view, Bundle bundle) {
        int v10 = com.ss.android.article.browser.R.color.ssxinmian4;
        Object v9 = null;
        int v8 = 8;
        super.onViewCreated(view, bundle);
        this.mAppData = AppData.getInstance();
        CallbackCenter.addCallback(BaseAppData.callbackTypeAddArticleCommentFromUpdate, this.aD);
        this.mArticleActionHelper = new ArticleActionHelper(this.getContext());
        this.mContext = this.getContext();
        this.F = this.mContext.getResources();
        this.mSpipe = Spipe.inst();
        this.D = AppData.isNightMode();
        this.L = true;
        this.G = DBHelper.getInstance(this.getContext());
        if (!this.u()) {
            this.getActivity().finish();
        } else {
            this.aj = new DetailHelper(this.getActivity(), ItemType.ARTICLE, this.mWeakHandler, this.mArticleActionHelper, "detail");
            if (!this.X) {
                this.X = this.mAppData.forceNoHwAcceleration();
            }

            Bundle v0 = this.getArguments();
            if (v0 != null && (v0.getBoolean("from_notification", false))) {
                this.Z = true;
            }

            this.aj.a();
            new ShareHelper(this.getContext(), ((IComponent) this), this.mAppData);
            ++this.x;
            this.ag = this.mAppData.mAllowHtmlVideo;
            this.mFullscreenVideoFrame = (FullscreenVideoFrame) this.a(com.ss.android.article.browser.R.id.customview_layout);
            this.mFullscreenVideoFrame.setListener(new aq(this));
            this.H = (ProgressBar) this.a(com.ss.android.article.browser.R.id.ss_htmlprogessbar);
            this.h = (ProgressBar) this.a(com.ss.android.article.browser.R.id.center_progress_bar);
            this.E = (SwipeOverlayFrameLayout) this.a(com.ss.android.article.browser.R.id.swipe_overlay);
            this.E.setVisibility(View.VISIBLE);
            this.E.setOnSwipeListener(new s(this));
            this.I = com.ss.android.article.base.ui.DiggAnimationView.a(this.g);
            Context v0_1 = this.getContext();
            this.aE = LayoutInflater.from(v0_1);
            this.aI = this.mAppData.mFontSizePref;
            v0_1.getResources().getDisplayMetrics();
            this.aJ = new InfoLRUCache(v8, v8);
            this.aK = new InfoLRUCache(v8, v8);
            this.mMyWebViewClient = new MyWebViewClientV11(((ArticleDetailWebPage) this));
            this.aG = new DetailWebChromeClient(this);
            ImageProvider.addOnRemoteImageLoadedListener(this);
            this.aM = this.mAppData.mDisableArticleInfoLayer;
            View v1 = this.a(com.ss.android.article.browser.R.id.detail_page);
            NewDetailViewHolder newDetailViewHolder = new NewDetailViewHolder();
            newDetailViewHolder.mDetailScrollView = v1.findViewById(com.ss.android.article.browser.R.id.webview_layout);
            newDetailViewHolder.mDetailScrollView.setVerticalScrollBarEnabled(true);
            newDetailViewHolder.mWebView = v1.findViewById(com.ss.android.article.browser.R.id.top_webview);
            newDetailViewHolder.mListView = v1.findViewById(com.ss.android.article.browser.R.id.bottom_listview);
            v1.findViewById(com.ss.android.article.browser.R.id.bottom_listview_layout);
            newDetailViewHolder.mNightModeOverlay = v1.findViewById(com.ss.android.article.browser.R.id.night_mode_overlay);
            boolean v0_2 = this.X ? false : true;
            if (Build.VERSION.SDK_INT < 16) {
                v0_2 = false;
            }

            SSWebSettings v3 = SSWebSettings.createWebSettings(this.getContext());
            v3.hardwareAccelerate = v0_2;
            v3.setJavaScriptEnabled(newDetailViewHolder.mWebView);
            newDetailViewHolder.mWebView.setWebViewClient(this.mMyWebViewClient);
            newDetailViewHolder.mWebView.setWebChromeClient(this.aG);
            if (this.mAppData.aD()) {
                com.bytedance.common.b.g.a();
            }

            String v0_3 = newDetailViewHolder.mWebView.getSettings().getUserAgentString();
            if (!android.support.design.a.isTextEmpty(v0_3)) {
                AppLog.f(v0_3);
            }

            this.aH = this.mAppData.a(this.getContext(), newDetailViewHolder.mWebView);
            AppUtil.getUserAgent(this.getContext(), newDetailViewHolder.mWebView);
            this.a(newDetailViewHolder.mWebView);
            newDetailViewHolder.mWebView.setDownloadListener(new t(this));
            newDetailViewHolder.mWebView.setOnScrollChangeListener(new u(this));
            if (this.aN == null) {
                this.aN = new NewArticleDetailTTAndroidObject(this.mAppData, this.getContext());
                this.aN.setFragment(((Fragment) this));
                this.aN.setWebView(newDetailViewHolder.mWebView);
                this.aN.c = this.Q;
                this.aN.a(this.aB);
            }

            v1.setTag(newDetailViewHolder);
            WebViewTweaker.tryTweakWebCoreHandler(this.mAppData.mHackWebCoreHandler, this.mAppData.mHackWebCoreHandlerZTE, this.mAppData.mHackWebCoreHandlerAll);
            v1 = this.aE.inflate(com.ss.android.article.browser.R.layout.ss_new_comment_footer, newDetailViewHolder.mListView, false);
            newDetailViewHolder.mFooter = new c(this, v1.findViewById(com.ss.android.article.browser.R.id.ss_footer_content));
            newDetailViewHolder.mFooter.hideFooterContent();
            newDetailViewHolder.mMoreTextView = v1.findViewById(com.ss.android.article.browser.R.id.ss_more);
            newDetailViewHolder.mListView.addFooterView(v1, v9, false);
            this.aA = (LinearLayout) this.aE.inflate(com.ss.android.article.browser.R.layout.detail_info_first_header2, newDetailViewHolder.mListView, false);
            View v0_4 = this.aE.inflate(com.ss.android.article.browser.R.layout.new_article_detail_info_second_header, newDetailViewHolder.mListView, false);
            newDetailViewHolder.mDetailScrollView.mDetailInfoFirstHeader2 = this.aA;
            newDetailViewHolder.mDetailScrollView.setDisableInfoLayer(this.aM);
            newDetailViewHolder.mNewDetailPageExtra = new NewDetailPageExtra(this.getActivity(), this.aA, v0_4);
            newDetailViewHolder.mNewDetailPageExtra.mSofaLayout.setOnClickListener(new v(this));
            newDetailViewHolder.mListView.getViewTreeObserver().addOnGlobalLayoutListener(new com.ss.android.wenda.answer.detail2.w(this));
            newDetailViewHolder.mListView.addHeaderView(this.aA, v9, false);
            newDetailViewHolder.mListView.addHeaderView(v0_4, v9, false);
            if (newDetailViewHolder.mNewDetailAdapter != null) {
                newDetailViewHolder.mNewDetailAdapter.onPause();
                newDetailViewHolder.mNewDetailAdapter.onDestroy();
            }

            newDetailViewHolder.mNewDetailAdapter = new NewDetailAdapter(this.mContext, this.I);
            newDetailViewHolder.mNewDetailAdapter.mArticle = this.mArticle;
            newDetailViewHolder.mNewDetailAdapter.a(newDetailViewHolder.mListView);
            newDetailViewHolder.mNewDetailAdapter.j = ((com.ss.android.article.base.feature.detail.presenter.a) this);
            newDetailViewHolder.mNewDetailAdapter.l = true;
            newDetailViewHolder.mNewDetailAdapter.i = false;
            newDetailViewHolder.mNewDetailAdapter.mAdId = this.s;
            newDetailViewHolder.mListView.setAdapter(newDetailViewHolder.mNewDetailAdapter);
            newDetailViewHolder.mListView.setRecyclerListener(newDetailViewHolder.mNewDetailAdapter);
            newDetailViewHolder.mListView.setOnScrollListener(new x(this));
            this.mNewDetailViewHolder = newDetailViewHolder;
            this.g.setBackgroundColor(this.F.getColor(v10));
            this.mNewDetailViewHolder.mWebView.setBackgroundColor(this.F.getColor(v10));
            this.aL = new com.ss.android.wenda.answer.detail2.a(this, this.mWeakHandler, this.R, this.Q, this.P);
            an v8_1 = new an(this);
            this.mArticleShareHelper = new ArticleShareHelper(this.getActivity(), this.mArticleActionHelper, this.aj, 200, true);
            this.mArticleShareHelper.w = 1;
            this.mArticleShareHelper.mNewArticleDetailTTAndroidObject = this.aN;
            this.mArticleShareHelper.s = this.Q;
            this.mArticleShareHelper.h = new ao(this);
            this.mArticleShareHelper.g = ((com.ss.android.article.share.e.b) v8_1);
            this.mArticleShareHelper.mExtJsonObj = this.J();
            this.mArticleShareHelper.mCategoryName = this.y;
            ArticleShareHelper v1_1 = this.mArticleShareHelper;
            v0_3 = this.mArticle != null ? this.mArticle.groupId + "" : "answer_detail";
            v1_1.detailSource = v0_3;
            if (this.ao == null) {
                this.ao = new ap(this);
            }

            ActivityStackManager.addActivity(Type.DETAIL_ACTIVITY, this.getActivity());
            if (!android.support.design.a.i()) {
                return;
            }

            FragmentActivity v0_5 = this.getActivity();
            al v1_2 = new al(this);
            ((NewAnswerDetailActivity) v0_5).k.setSearchIconVisibility(0);
            ((NewAnswerDetailActivity) v0_5).k.setSearchClickListener(((View.OnClickListener) v1_2));
            this.aS = false;
        }
    }

    static int[] p(NewAnswerDetailFragment arg1) {
        return arg1.aV;
    }

    public final void p() {
        if (this.mNewDetailViewHolder == null || this.mNewDetailViewHolder.mNewDetailPageExtra == null || this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo == null || !this.mNewDetailViewHolder.mNewDetailPageExtra.mArticleInfo.wendaData.isBanComment) {
            Article v0 = this.mArticle;
            if (v0 != null) {
                if (((AbsArticle) v0).mBanComment) {
                    if (!this.s()) {
                        ((NewAnswerDetailActivity) this.getActivity()).a(false);
                    }
                } else if (this.aj != null) {
                    this.aj.a("", 0, true);
                    this.aO = 0;
                }
            }
        } else {
            this.a(com.ss.android.article.browser.R.drawable.close_popup_textpage, com.ss.android.article.browser.R.string.wenda_baned_comment_hint);
        }
    }

    final void q() {
        if (!this.s()) {
            try {
                Animation v0_1 = AnimationUtils.loadAnimation(this.mContext, android.R.anim.fade_out);
                if (this.H.getVisibility() != View.VISIBLE) {
                    return;
                }

                this.H.startAnimation(v0_1);
                this.H.setVisibility(View.GONE);
            } catch (Throwable v0) {
            }
        }
    }

    static boolean q(NewAnswerDetailFragment arg1) {
        return arg1.al;
    }

    static boolean r() {
        return true;
    }

    static boolean r(NewAnswerDetailFragment arg1) {
        return arg1.ak;
    }

    private boolean s() {
        FragmentActivity fragmentActivity = this.getActivity();
        return fragmentActivity == null || (fragmentActivity.isFinishing());
    }

    static boolean s(NewAnswerDetailFragment arg1) {
        arg1.al = true;
        return true;
    }

    public void startActivityForResult(Intent arg1, int arg2) {
    }

    private String t() {
        UrlBuilder v0 = new UrlBuilder("sslocal://wenda_list");
        v0.addParam("qid", this.mArticleDetail.qid);
        com.ss.android.article.base.utils.JSONObjectWrapper v1 = new com.ss.android.article.base.utils.JSONObjectWrapper();
        v1.put("enter_from", "click_header");
        v0.addParam("gd_ext_json", v1.jsonObject.toString());
        String v1_1 = android.support.design.a.f(this.Q, "answer_detail");
        if (!android.support.design.a.isTextEmpty(v1_1)) {
            v0.addParam("api_param", v1_1);
        }

        return v0.build();
    }

    static boolean t(NewAnswerDetailFragment arg1) {
        return arg1.as;
    }

    static boolean u(NewAnswerDetailFragment arg1) {
        return arg1.at;
    }

    private boolean u() {
        String v3_2;
        JSONObject v3_1;
        boolean v0;
        long v6 = 0;
        Bundle v2 = this.getArguments();
        if (v2 == null) {
            v0 = false;
            return v0;
        }

        this.mArticle = ((NewAnswerDetailActivity) this.getActivity()).h;
        if (this.mArticle != null && this.mArticle.groupId > v6) {
            this.mAppData.a(this.mArticle);
        }

        if (this.mArticle == null) {
            return false;
        }

        this.X = v2.getBoolean("bundle_no_hw_acceleration", false);
        this.mArticleDetail = ((NewAnswerDetailActivity) this.getActivity()).m;
        this.W = v2.getBoolean("from_notification", false);
        this.P = v2.getString("gd_ext_json");
        this.Q = v2.getString("api_param");
        this.Q = android.support.design.a.a(this.Q, this.R, "answer_detail");
        this.y = v2.getString("category");
        this.R = JsonUtil.a(this.P, "enter_from");
        v0 = v2.getBoolean("view_comments", false);
        this.M = v2.getBoolean("is_jump_comment", false);
        this.at = this.M;
        this.N = v2.getBoolean("show_write_comment_dialog", false);
        this.aR = v2.getString("growth_from");
        if (v2.containsKey("detail_source")) {
            v2.getString("detail_source");
        }

        if (v2.containsKey("stay_tt")) {
            this.O = v2.getInt("stay_tt");
            if (this.O == 0) {
                v2.getInt("previous_task_id");
                v2.getString("previous_task_intent");
            }
        }

        try {
            v3_1 = new JSONObject(this.P);
            if (!v3_1.has("log_pb")) {
            } else {
                v3_2 = v3_1.optString("log_pb");
                if (android.support.design.a.isTextEmpty(v3_2)) {
                } else {
                    this.z = new JSONObject(v3_2);
                }
            }
        } catch (JSONException v3) {
        }

        label_91:
        this.r = v2.getBoolean("view_single_id", false);
        this.c = this.mArticle.groupId;
        this.u = this.mArticle.itemId;
        this.v = this.mArticle.aggrType;
        this.s = v2.getLong("ad_id", v6);
        this.b = v2.getString("bundle_download_app_extra");
        this.t = v2.getBoolean("bundle_forbid_jump", false);
        if (!android.support.design.a.isTextEmpty(this.P)) {
            try {
                v3_1 = new JSONObject(this.P);
                this.B = v3_1.optString("source");
                this.C = v3_1.optString("query");
                this.A = v3_1.optLong("search_result_id");
                if (!v3_1.has("log_pb")) {
                } else {
                    v3_2 = v3_1.optString("log_pb");
                    if (android.support.design.a.isTextEmpty(v3_2)) {
                    } else {
                        this.z = new JSONObject(v3_2);
                    }
                }
            } catch (JSONException v3) {
            }
        }

        if (this.r) {
            this.w = v2.getLong("from_gid", v6);
            if (this.s > v6) {
                this.am = v2.getString("article_url");
            }
        } else {
            v2.getInt("list_type", 0);
            if (this.mNewDetailViewHolder != null && this.mNewDetailViewHolder.mNewDetailAdapter != null) {
                this.mNewDetailViewHolder.mNewDetailAdapter.mAdId = this.s;
            }

            if (!v0) {
                return true;
            }

            if (this.mArticle == null) {
                return true;
            }

            this.S = this.mArticle.groupId;
            if (this.mArticle.comment == null) {
                return true;
            }

            this.T = this.mArticle.comment.commentId;
        }

        return true;
    }

    private void v() {
        if (!this.s()) {
            ((NewAnswerDetailActivity) this.getActivity()).k.showCloseAllWebpageIv();
        }
    }

    static void v(NewAnswerDetailFragment arg15) {
        long v6 = 0;
        NewDetailViewHolder v0 = arg15.mNewDetailViewHolder;
        if (v0 != null) {
            Article v3 = arg15.mArticle;
            if (v3 == null) {
                v0.mFooter.hideFooterContent();
            } else {
                boolean v1 = v0.everEnterComment;
                v0.everEnterComment = true;
                CommentTabCache v8 = arg15.a(v3.groupId, v0);
                if (!v8.load[0]) {
                    ArticleTabComment v2 = v8.mArticleTabComments[0];
                    if (!v2.hasComment) {
                        if (NetworkUtils.isNetworkAvailable(arg15.mContext)) {
                            CommentFetcher v1_1 = new CommentFetcher(v8.mArticleTabComments[0].increateCounter(), ((AbsArticle) v3), 0, 0, v6);
                            arg15.aL.a(v1_1.getItemKey(), v1_1);
                            v8.load[0] = true;
                            v0.mFooter.switchToLoading();
                            arg15.a(v6);
                        } else {
                            arg15.K();
                        }
                    } else if (v3.groupId != v8.itemId) {
                        v0.mFooter.hideFooterContent();
                    } else {
                        if (!v1 && (v0.mNewDetailAdapter.hasComments())) {
                            arg15.a(v0, v8);
                            if (!v0.isDetailCommentsShowReported) {
                                v0.isDetailCommentsShowReported = true;
                                arg15.a("enter_comment", ((BaseArticle) v3), arg15.s);
                            } else {
                            }

                            return;
                        }

                        if (v2.isEmpty()) {
                            v0.mFooter.hideFooterContent();
                            return;
                        }

                        if (v8.load[0]) {
                            v0.mFooter.switchToLoading();
                            return;
                        }

                        if (!NetworkUtils.isNetworkAvailable(arg15.mContext)) {
                            arg15.K();
                            return;
                        }

                        MobClickCombiner.onEvent(arg15.getContext(), "detail", "comment_loadmore");
                        v8.load[0] = true;
                        v0.mFooter.switchToLoading();
                        new ArticleTabCommentsRequestTask(arg15.mContext, arg15.mWeakHandler,
                                new CommentFetcher(v2.increateCounter(),
                                        ((AbsArticle) v3), 0, v2.offset, v6)).start();
                        if (v0.isFinishCommentReported) {
                            return;
                        }

                        v0.isFinishCommentReported = true;
                        arg15.a("finish_comment", ((BaseArticle) v3), arg15.s);
                    }
                }
            }
        }
    }

    static boolean w(NewAnswerDetailFragment arg1) {
        return arg1.aq;
    }

    private void w() {
        JSONObject v0_2;
        JSONObject v6;
        String v8 = null;
        long v10 = 0;
        if (this.p != null && this.p.groupId > v10 && this.o > v10) {
            long v4 = System.currentTimeMillis() - this.o;
            if (v4 <= 3000) {
                return;
            }

            try {
                v6 = android.support.design.a.isTextEmpty(this.P) ? new JSONObject() : new JSONObject(this.P);
                if (this.q <= v10) {
                } else {
                    v6.put("ad_id", this.q);
                }
            } catch (Exception v0) {
                v6 = ((JSONObject) null);
            }

            if (AppData.getInstance().getAbSettings().isAppLogOld()) {
                this.a("stay_page", this.p, v4, v6);
            }

            if (AppData.getInstance().getAbSettings().isAppLogNew()) {
                if (v6 == null) {
                    v0_2 = new JSONObject();
                } else {
                    v0_2 = v6;
                }

                try {
                    v0_2.put("stay_time", v4);
                } catch (JSONException v1) {
                }

                this.a("stay_page", v0_2, this.p);
            }

            if (this.mNewDetailViewHolder != null && this.s > v10) {
                JSONObject v9 = new JSONObject();
                try {
                    v9.put("log_extra", this.b);
                } catch (JSONException v0_1) {
                    v0_1.printStackTrace();
                }

                WapStatHelper.a(this.getActivity(), v4, this.s, v8, v9);
            }

            if (this.q <= v10) {
                return;
            }

            this.a("stay_page2", this.p, this.q);
        }
    }

    static NextAnswerView x(NewAnswerDetailFragment arg1) {
        return arg1.aw;
    }

    private void x() {
        if (!this.s()) {
            NewDetailViewHolder v0 = this.mNewDetailViewHolder;
            if (v0 != null) {
                if (v0.mNewDetailAdapter.h) {
                    v0.mNewDetailAdapter.h = false;
                }

                if ((v0.mDetailScrollView.c) && this.mArticle != null && this.mArticle.commentCount == 0) {
                    this.p();
                }

                this.as = v0.mDetailScrollView.handleOpenDrawer(true);
                if (v0.mDetailScrollView.getVisibility() != View.VISIBLE) {
                    return;
                }

                if (!this.as) {
                    return;
                }

                if (v0.everEnterComment) {
                    return;
                }

                v0.everEnterComment = true;
                if (!v0.mNewDetailAdapter.hasComments()) {
                    return;
                }

                if (v0.mCommentTabCache == null) {
                    return;
                }

                this.a(v0, v0.mCommentTabCache);
            }
        }
    }

    static int y(NewAnswerDetailFragment arg1) {
        return arg1.ax;
    }

    public final void onBackClick() {
        this.aa = true;
        this.onBack();
    }

    static boolean z(NewAnswerDetailFragment arg1) {
        return arg1.ay;
    }

    public final void onTopMoreTitleClick() {
        MobClickCombiner.onEvent(this.getContext(), "answer_detail", "more_clicked");
        this.report("preferences");
        if (this.mArticleShareHelper != null) {
            this.a(true);
        }
    }
}

